:root {
  --blue: #2581dc;
  --blue-2: #19b7e8;
  --ink: #111827;
  --muted: #657384;
  --line: #dce8f2;
  --soft: #f3f8fc;
  --panel: #ffffff;
  --danger: #ff2c3a;
  --green: #12b76a;
  --violet: #a855f7;
  --orange: #ff7a1a;
  --shadow: 0 10px 30px rgba(40, 93, 137, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, #f5f9fc 0%, #f1f6fa 46%, #f7fafc 100%);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

body.theme-dark {
  --ink: #eaf4ff;
  --muted: #9aacbf;
  --line: #294158;
  --soft: #122235;
  --panel: #0f1c2b;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
  color: var(--ink);
  background: linear-gradient(180deg, #08111f 0%, #0d1b2b 48%, #091522 100%);
}

body.theme-dark .page-shell,
body.theme-dark .draw-card,
body.theme-dark .result-shell,
body.theme-dark .timer-block,
body.theme-dark .table-wrap,
body.theme-dark .view-tabs,
body.theme-dark .settings-menu,
body.theme-dark .insight-card,
body.theme-dark .admin-panel,
body.theme-dark .admin-sidebar,
body.theme-dark .login-card,
body.theme-dark .site-modal-card,
body.theme-dark .analysis-box,
body.theme-dark .opened-stats-panel,
body.theme-dark .dragon-card,
body.theme-dark .keno-process-panel {
  border-color: #28425b;
  background: #0f1c2b;
  box-shadow: var(--shadow);
}

body.theme-dark .draw-card,
body.theme-dark .admin-panel,
body.theme-dark .table-wrap {
  background: #101f30;
}

body.theme-dark th,
body.theme-dark .analysis-box-title,
body.theme-dark .view-tabs button,
body.theme-dark .settings-item,
body.theme-dark .opened-date-controls,
body.theme-dark .api-url-label {
  color: #cbd8e6;
  border-color: #263c54;
  background: #132438;
}

body.theme-dark td,
body.theme-dark .latest-line,
body.theme-dark .admin-title p,
body.theme-dark .visit-stats,
body.theme-dark .analysis-alert {
  color: #9aacbf;
}

body.theme-dark .latest-title,
body.theme-dark .latest-line strong:not(.latest-title),
body.theme-dark .op,
body.theme-dark .admin-title h1,
body.theme-dark .analysis-box-title,
body.theme-dark .formula,
body.theme-dark .member-table strong {
  color: #eef7ff;
}

body.theme-dark tr:nth-child(even),
body.theme-dark .view-tabs button.active,
body.theme-dark .sidebar-link:hover,
body.theme-dark .sidebar-link.active,
body.theme-dark .draw-tool-button:hover,
body.theme-dark #settingsButton.is-open,
body.theme-dark .analysis-metric,
body.theme-dark .opened-cell {
  color: #eff8ff;
  background: #172a40;
}

body.theme-dark tr:nth-child(odd),
body.theme-dark .num-ball,
body.theme-dark .analysis-number {
  background: #182b42;
}

body.theme-dark .num-ball {
  color: #f4f9ff;
}

body.theme-dark .num-ball.sum {
  background: #08aeea;
}

body.theme-dark .draw-tool-button,
body.theme-dark .header-button,
body.theme-dark .footer-action {
  color: #eaf4ff;
  border-color: #31506b;
  background: linear-gradient(180deg, #162a40, #102136);
}

body.theme-dark .setting-state {
  color: #dbeafe;
  background: #20364d;
}

body.theme-dark .setting-state.on {
  color: #083344;
  background: #7dd3fc;
}

button {
  cursor: pointer;
  font: inherit;
}

.hidden {
  display: none !important;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 54px;
  background: linear-gradient(180deg, #2b88e5, #237bd6);
  box-shadow: 0 4px 16px rgba(21, 89, 158, 0.28);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100%, 1120px);
  height: 100%;
  margin: 0 auto;
  padding: 0 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-size: 19px;
  font-weight: 800;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  color: #fff;
  background:
    radial-gradient(circle at 72% 78%, #ffd25a 0 4px, transparent 5px),
    linear-gradient(135deg, #ff4a71, #ff815d);
  font-size: 11px;
  font-weight: 900;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 7px;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  text-decoration: none;
}

.header-button:hover {
  background: rgba(255, 255, 255, 0.18);
}

.header-button svg,
.draw-tool-button svg,
.settings-item svg,
.insight-icon svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.draw-tool-button svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.page-shell {
  width: min(calc(100% - 28px), 1120px);
  margin: 14px auto 40px;
}

.top-ad-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.top-ad {
  position: relative;
  display: grid;
  grid-template-columns: 150px 1fr auto;
  align-items: center;
  gap: 24px;
  min-height: 116px;
  padding: 12px 26px;
  overflow: hidden;
  border-radius: 7px;
  color: #fff;
  text-decoration: none;
  box-shadow: 0 10px 26px rgba(20, 52, 92, 0.16);
  isolation: isolate;
}

.top-ad::before,
.top-ad::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.top-ad::before {
  inset: 0;
  background:
    linear-gradient(100deg, transparent 0 34%, rgba(255, 255, 255, 0.38) 45%, transparent 56%),
    linear-gradient(110deg, rgba(255, 255, 255, 0.18), transparent 32%),
    radial-gradient(circle at 78% 50%, rgba(255, 255, 255, 0.22), transparent 20%);
  background-size: 240% 100%, 100% 100%, 100% 100%;
  animation: adSweep 2.4s linear infinite;
}

.top-ad::after {
  right: -34px;
  bottom: -56px;
  width: 250px;
  height: 145px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  animation: adGlow 1.6s ease-in-out infinite alternate;
}

.top-ad-purple {
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 34px),
    linear-gradient(100deg, #1b063d, #4a1296 52%, #210057);
  animation: adColorPulse 1.8s ease-in-out infinite alternate;
}

.top-ad-pink {
  color: #fff;
  background:
    linear-gradient(100deg, rgba(255, 255, 255, 0.82) 0 26%, rgba(255, 255, 255, 0.25) 26% 31%, transparent 31%),
    linear-gradient(100deg, #f2b4bf, #f4a2ac 58%, #7fdcff);
  animation: adColorPulse 1.8s ease-in-out infinite alternate-reverse;
}

.middle-ad-slot {
  margin-top: 14px;
}

.top-ad-cyan {
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.12) 0 1px, transparent 1px 32px),
    linear-gradient(100deg, #ff3b21 0%, #ef7412 34%, #13b8df 100%);
  animation: adColorPulse 1.8s ease-in-out infinite alternate;
}

.middle-ad {
  grid-template-columns: 120px 1fr auto;
  gap: 18px;
  min-height: 82px;
  padding: 10px 22px;
}

.middle-ad .ad-emblem {
  width: 86px;
  height: 58px;
  border-color: rgba(255, 255, 255, 0.88);
  color: #fffbe7;
  font-size: 28px;
}

.middle-ad .ad-copy strong {
  font-size: clamp(22px, 2.8vw, 32px);
}

.middle-ad .ad-copy span {
  font-size: clamp(17px, 2vw, 24px);
}

.middle-ad .ad-cta {
  min-width: 130px;
  min-height: 36px;
  color: #ef4b23;
  background: rgba(255, 255, 255, 0.92);
  font-size: clamp(18px, 2vw, 24px);
}

.top-ad-image {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.top-ad.has-image > :not(.top-ad-image) {
  position: relative;
  z-index: 1;
}

.top-ad.has-image::before {
  z-index: 1;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.14));
}

.ad-emblem,
.ad-copy,
.ad-cta {
  position: relative;
  z-index: 1;
}

.ad-emblem {
  display: inline-grid;
  place-items: center;
  width: 116px;
  height: 82px;
  border: 3px solid rgba(255, 226, 111, 0.88);
  border-radius: 12px;
  color: #fff5b8;
  background: rgba(0, 0, 0, 0.2);
  font-size: 34px;
  font-weight: 900;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}

.ad-emblem.crown {
  border-color: rgba(255, 255, 255, 0.82);
  color: #3c2028;
  background: rgba(255, 255, 255, 0.78);
  font-size: 30px;
}

.ad-copy {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.ad-copy strong {
  font-size: clamp(26px, 3.3vw, 38px);
  line-height: 1.1;
  font-weight: 900;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
}

.ad-copy span {
  font-size: clamp(20px, 2.5vw, 30px);
  font-weight: 900;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}

.top-ad-pink .ad-copy strong,
.top-ad-pink .ad-copy span {
  color: #5b2633;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.78), 0 2px 6px rgba(255, 255, 255, 0.36);
}

.top-ad-pink .ad-copy strong {
  color: #7c1f35;
}

.top-ad-pink .ad-copy span {
  color: #5f2b37;
}

.ad-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 210px;
  min-height: 44px;
  padding: 0 24px;
  border-radius: 24px;
  color: #471375;
  background: #fff;
  font-size: clamp(22px, 2.8vw, 34px);
  font-weight: 900;
  white-space: nowrap;
}

.top-ad-purple .ad-cta {
  color: #fff233;
  background: rgba(255, 255, 255, 0.15);
  animation: adCtaFlash 1.1s ease-in-out infinite alternate;
}

.top-ad-pink .ad-cta {
  color: #cc5062;
  background: rgba(255, 255, 255, 0.88);
  animation: adCtaFlash 1.1s ease-in-out infinite alternate;
}

@keyframes adSweep {
  from {
    background-position: 180% 0, 0 0, 0 0;
  }
  to {
    background-position: -80% 0, 0 0, 0 0;
  }
}

@keyframes adGlow {
  from {
    opacity: 0.45;
    transform: scale(0.96);
  }
  to {
    opacity: 0.9;
    transform: scale(1.08);
  }
}

@keyframes adColorPulse {
  from {
    filter: saturate(1) brightness(1);
  }
  to {
    filter: saturate(1.35) brightness(1.13);
  }
}

@keyframes adCtaFlash {
  from {
    box-shadow: 0 0 0 rgba(255, 255, 255, 0);
  }
  to {
    box-shadow: 0 0 18px rgba(255, 255, 255, 0.55);
  }
}

.draw-card {
  position: relative;
  min-height: 210px;
  padding: 28px 24px 25px;
  overflow: visible;
  border: 1px solid #cfe3f2;
  border-radius: 0 0 13px 13px;
  background: #fff;
  box-shadow: var(--shadow);
}

.draw-card::before {
  content: "";
  position: absolute;
  inset: -1px -1px auto;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(90deg, #00b8eb, #10bfd3 48%, #4d69a8);
}

.draw-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.latest-line {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  color: #4d5b6b;
  white-space: nowrap;
}

.latest-title {
  color: #111923;
  font-size: 20px;
  font-weight: 900;
}

.latest-line strong:not(.latest-title) {
  color: #111923;
  font-size: 16px;
  font-weight: 900;
}

.draw-actions {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.settings-wrap {
  position: relative;
}

.draw-tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 74px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #d8e2ec;
  border-radius: 7px;
  color: #202b36;
  background: linear-gradient(180deg, #fff, #f3f7fb);
  box-shadow: 0 2px 5px rgba(31, 64, 91, 0.08);
  font-weight: 600;
}

.draw-tool-button:hover,
.draw-tool-button.is-display,
#settingsButton.is-open {
  border-color: #b9d9ed;
  background: #eaf7ff;
}

.settings-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  width: 178px;
  overflow: hidden;
  border: 1px solid #d9e3ec;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 14px 30px rgba(31, 64, 91, 0.16);
}

.settings-menu::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 28px;
  width: 10px;
  height: 10px;
  border-top: 1px solid #d9e3ec;
  border-left: 1px solid #d9e3ec;
  background: #fff;
  transform: rotate(45deg);
}

.settings-item {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 16px 1fr auto;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-bottom: 1px solid #edf1f5;
  color: #1f2a34;
  background: #fff;
  text-align: left;
  font-size: 13px;
}

.settings-item:last-child {
  border-bottom: 0;
}

.settings-item:hover {
  background: #f5fbff;
}

.setting-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 20px;
  padding: 0 6px;
  border-radius: 5px;
  color: #6b7480;
  background: #edf2f6;
  font-size: 12px;
  font-weight: 700;
}

.setting-state.wide {
  min-width: 34px;
}

.setting-state.on {
  color: #0387c9;
  background: #cceeff;
}

.draw-main {
  display: grid;
  grid-template-columns: 260px 400px;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 53px;
}

.timer-block {
  --timer-progress: 0%;
  --timer-progress-value: 0;
  --timer-top: 0%;
  --timer-right: 0%;
  --timer-bottom: 0%;
  --timer-left: 0%;
  --timer-accent: #09aee8;
  --timer-border-color: #cfe7f5;
  --timer-bg: #f7fbff;
  position: relative;
  display: flex;
  align-items: center;
  gap: 38px;
  min-height: 70px;
  padding: 0 20px;
  overflow: hidden;
  border: 1px solid var(--timer-border-color);
  border-radius: 9px;
  color: #111923;
  background: var(--timer-bg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 1px 4px rgba(25, 128, 190, 0.07);
  white-space: nowrap;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.timer-block.is-danger {
  --timer-accent: #ff1638;
  --timer-border-color: #ff5268;
  --timer-bg: #fff8f9;
  color: #ff1638;
}

.timer-block.is-opening {
  --timer-accent: #05aae9;
  --timer-border-color: #17b9f0;
  --timer-bg: #f6fbff;
}

.timer-block.is-updated {
  --timer-accent: #16c963;
  --timer-border-color: #5dda89;
  --timer-bg: #ecfff4;
  color: #10a84f;
}

.timer-border {
  position: absolute;
  inset: -1px;
  z-index: 0;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

.timer-edge {
  position: absolute;
  display: block;
  background: var(--timer-accent);
  transition: width 0.85s linear, height 0.85s linear, background 0.2s ease;
}

.timer-edge-top {
  left: 0;
  top: 0;
  width: var(--timer-top);
  height: 3px;
}

.timer-edge-right {
  right: 0;
  top: 0;
  width: 3px;
  height: var(--timer-right);
}

.timer-edge-bottom {
  right: 0;
  bottom: 0;
  width: var(--timer-bottom);
  height: 3px;
}

.timer-edge-left {
  left: 0;
  bottom: 0;
  width: 3px;
  height: var(--timer-left);
}

.timer-block > * {
  position: relative;
  z-index: 1;
}

.timer-block > .timer-border {
  position: absolute;
  z-index: 0;
}

.clock-icon {
  --clock-size: 18px;
  --clock-stroke: 2px;
  position: relative;
  width: var(--clock-size);
  height: var(--clock-size);
  box-sizing: border-box;
  border: var(--clock-stroke) solid #04aeea;
  border-color: var(--timer-accent);
  border-radius: 50%;
}

.clock-icon::before,
.clock-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  width: var(--clock-stroke);
  border-radius: 2px;
  background: var(--timer-accent);
}

.clock-icon::before {
  top: 4px;
  height: 5px;
  transform: translateX(-50%);
}

.clock-icon::after {
  top: 50%;
  height: var(--clock-stroke);
  width: 5px;
  transform: translateY(-50%);
  transform-origin: left center;
}

.timer-copy {
  display: grid;
  gap: 2px;
}

.timer-label {
  color: #758291;
  font-size: 13px;
}

.timer-block.is-danger .timer-label,
.timer-block.is-danger .timer-value strong {
  color: #ff1638;
}

.timer-block.is-opening .timer-label,
.timer-block.is-opening .timer-message {
  color: #536272;
}

.timer-block.is-updated .timer-label,
.timer-block.is-updated .timer-value strong {
  color: #10a84f;
}

.timer-count {
  display: inline;
}

.timer-message {
  color: #536272;
  font-size: 14px;
  font-weight: 600;
}

.timer-block.is-opening .timer-count {
  display: none;
}

.timer-block.is-opening .timer-message {
  display: inline;
}

.timer-block.is-opening .clock-icon {
  border-right-color: transparent;
  animation: timerSpin 0.8s linear infinite;
}

.timer-block.is-opening .clock-icon::before,
.timer-block.is-opening .clock-icon::after {
  display: none;
}

.timer-value strong {
  display: inline;
  color: #111923;
  font-size: 19px;
  font-family: Arial, sans-serif;
  font-weight: 900;
}

@keyframes timerSpin {
  to {
    transform: rotate(360deg);
  }
}

.result-shell {
  position: relative;
  min-height: 88px;
  padding: 12px 18px;
  border: 1px solid #e8edf3;
  border-radius: 9px;
  background: #fff;
}

.number-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 64px;
  white-space: nowrap;
}

.num-ball {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 9px;
  color: #111923;
  background: #e8edf3;
  font-size: 34px;
  font-weight: 900;
}

.num-ball.sum {
  color: #fff;
  background: #13aee2;
}

.combo-result {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.combo-result.hidden {
  display: none;
}

.combo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #fff;
  font-size: 18px;
  font-weight: 900;
}

.combo-badge.red {
  background: #ff2938;
}

.combo-badge.blue {
  background: #287cf7;
}

.result-shell.has-combo {
  padding: 12px 14px;
}

.result-shell.has-combo .number-block {
  gap: 8px;
}

.result-shell.has-combo .num-ball {
  width: 50px;
  height: 50px;
  font-size: 30px;
}

.result-shell.has-combo .inline-scratch-canvas {
  inset: 12px 14px;
  width: calc(100% - 28px);
}

.op {
  color: #111923;
  font-size: 26px;
  font-weight: 800;
}

.inline-scratch-canvas {
  position: absolute;
  inset: 12px 18px;
  z-index: 3;
  width: calc(100% - 36px);
  height: calc(100% - 24px);
  border-radius: 9px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  contain: paint;
  will-change: contents;
  cursor: grab;
}

.inline-scratch-canvas:active {
  cursor: grabbing;
}

.result-shell.is-hidden .inline-scratch-canvas {
  display: block !important;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.insight-card {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 74px;
  padding: 13px 14px;
  border: 1px solid #e7edf3;
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 7px 20px rgba(37, 87, 128, 0.08);
}

.insight-card p {
  margin: 0 0 5px;
  color: #5c6978;
  font-size: 13px;
}

.insight-card strong {
  display: inline-block;
  margin-right: 8px;
}

.insight-icon {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  flex: 0 0 auto;
}

.insight-icon.purple {
  color: #8b5cf6;
  background: #f0e9ff;
}

.insight-icon.cyan {
  color: #0ea5e9;
  background: #e1f6ff;
}

.insight-icon.rose {
  color: #fb2c63;
  background: #ffe8ed;
}

.insight-icon.orange {
  color: #f97316;
  background: #fff0e4;
}

.mini-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  padding: 0 7px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 800;
}

.tag.blue {
  color: #5b21b6;
  background: #ede9fe;
}

.tag.orange {
  color: #ea580c;
  background: #ffedd5;
}

.tag.red {
  color: var(--danger);
  background: #ffe5e8;
}

.tag.violet {
  color: var(--violet);
  background: #f3e8ff;
}

.tag.green {
  color: var(--green);
  background: #dffbea;
}

.tag.gray {
  color: #64748b;
  background: #edf2f7;
}

.danger-text {
  color: #ff5c00;
  font-size: 12px;
  font-weight: 700;
}

.content-panel {
  margin-top: 14px;
}

.view-tabs {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0;
  overflow: hidden;
  border: 1px solid #d2dde8;
  border-radius: 10px;
  background: #eaf1f7;
  box-shadow: inset 0 1px 2px rgba(37, 87, 128, 0.08);
}

.view-tabs button {
  min-height: 48px;
  border: 0;
  border-right: 1px solid #d8e2ec;
  color: #5d6a78;
  background: transparent;
  font-weight: 700;
}

.view-tabs button:last-child {
  border-right: 0;
}

.view-tabs button.active {
  color: #222a33;
  background: #fff;
  box-shadow: inset 0 0 0 1px #d6e1eb, 0 2px 5px rgba(37, 87, 128, 0.08);
}

.table-wrap {
  margin-top: 16px;
  overflow-x: auto;
  border: 1px solid #dbe6ef;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(37, 87, 128, 0.08);
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  height: 41px;
  padding: 0 12px;
  text-align: center;
}

th {
  color: #606b78;
  background: #f0f2f5;
  font-weight: 800;
}

tbody tr:nth-child(odd) {
  background: #f8fdff;
}

tbody tr:nth-child(even) {
  background: #fff;
}

tbody tr:hover {
  background: #eef8ff;
}

.draw-table td:first-child {
  font-weight: 900;
}

.formula {
  font-weight: 900;
}

.pill-group {
  display: inline-flex;
  gap: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 26px;
  padding: 0 8px;
  border-radius: 14px;
  color: #fff;
  font-weight: 900;
}

.table-empty {
  height: 92px;
  color: #708195;
  text-align: center;
  font-weight: 800;
}

.pill.blue {
  background: #287cf7;
}

.pill.red {
  background: #ff2938;
}

.pill.green {
  background: #11b863;
}

.pill.gray {
  color: #475569;
  background: #eef3f7;
  box-shadow: inset 0 0 0 1px #cdd8e2;
}

.shape-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 25px;
  padding: 0 10px;
  border-radius: 999px;
  font-weight: 900;
  line-height: 1;
}

.shape-pill.mixed {
  color: #243447;
  background: #fff;
  box-shadow: inset 0 0 0 1px #cbd8e4;
}

.shape-pill.pair {
  color: #c97700;
  background: #fff7df;
  box-shadow: inset 0 0 0 1px #f6c75d;
}

.shape-pill.straight {
  color: #079044;
  background: #e8fff1;
  box-shadow: inset 0 0 0 1px #72d99a;
}

.shape-pill.triple {
  color: #8b5cf6;
  background: #f3ebff;
  box-shadow: inset 0 0 0 1px #c4b5fd;
}

.pill.cyan {
  color: #0891b2;
  background: #e0f8ff;
  box-shadow: inset 0 0 0 1px #6ee7f9;
}

.pill.violet {
  color: #9333ea;
  background: #f4e8ff;
  box-shadow: inset 0 0 0 1px #d8b4fe;
}

.result-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 64px;
  padding: 10px 0 14px;
  background: #fff;
}

.pager-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  border: 0;
  border-radius: 9px;
  color: #64748b;
  background: transparent;
  font-weight: 800;
}

.pager-button.active {
  color: #fff;
  background: #08aeea;
  box-shadow: 0 8px 18px rgba(8, 174, 234, 0.28);
}

.pager-button.icon {
  color: #94a3b8;
  background: #f2f7fb;
  font-size: 22px;
}

.pager-button:disabled {
  opacity: 0.55;
  cursor: default;
}

.pager-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 32px;
  color: #94a3b8;
  font-weight: 900;
}

body.theme-dark .result-pager {
  background: #101f30;
}

body.theme-dark .pager-button {
  color: #aac0d6;
}

body.theme-dark .pager-button.icon {
  color: #cfe7ff;
  background: #172a40;
}

body.theme-dark .pager-button.active {
  color: #fff;
}

.visit-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px 12px;
  margin: 14px 2px 0;
  padding: 0 10px 8px;
  color: #8a98a8;
  font-size: 12px;
  line-height: 1.7;
}

.visit-stats strong {
  color: #233142;
  font-weight: 900;
}

.footer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 18px 0 2px;
}

.footer-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid #d6e3ee;
  border-radius: 4px;
  color: #6a7887;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 4px 12px rgba(37, 87, 128, 0.06);
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
}

.footer-action:hover {
  color: #078fc7;
  border-color: #acdff3;
  background: #f4fcff;
}

.footer-icon {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  color: #08aeea;
  background: #e2f7ff;
  font-size: 11px;
  font-weight: 900;
}

.site-modal.hidden {
  display: none;
}

.site-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
}

.site-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(3px);
}

.site-modal-card {
  position: relative;
  z-index: 1;
  width: min(520px, calc(100vw - 36px));
  max-height: min(72vh, 620px);
  overflow: auto;
  padding: 22px 24px 24px;
  border: 1px solid #d8e6f0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(22, 54, 85, 0.26);
}

.site-modal-card h2 {
  margin: 0 36px 14px 0;
  color: #111923;
  font-size: 20px;
}

.site-modal-content {
  color: #4f5f70;
  line-height: 1.85;
  white-space: pre-line;
  font-size: 14px;
}

.site-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border: 1px solid #dbe6ef;
  border-radius: 50%;
  color: #64748b;
  background: #f8fbfe;
  font-size: 22px;
  line-height: 1;
}

body.has-site-modal {
  overflow: hidden;
}

.analysis-table {
  min-width: 820px;
}

.mark-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 7px;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.mark-badge.orange {
  background: #ff7417;
}

.mark-badge.green {
  background: #71c934;
}

.mark-badge.blue {
  background: #0b86ef;
}

.mark-badge.red {
  background: #ff2938;
}

.mark-badge.purple {
  background: #8b5cf6;
}

.number-analysis-panel {
  min-width: 980px;
  padding: 16px;
  background: #fff;
}

.analysis-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  padding: 0 12px;
  border-radius: 8px;
  background: #f7fafc;
}

.analysis-toolbar h3 {
  margin: 0;
  color: #111923;
  font-size: 18px;
}

.analysis-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #536174;
  font-size: 13px;
  font-weight: 800;
}

.analysis-controls input {
  width: 86px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid #d6e1eb;
  border-radius: 5px;
  background: #f8fbff;
  color: #111923;
  font-weight: 900;
  text-align: center;
}

.analysis-run {
  min-width: 82px;
  height: 36px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: #08aeea;
  box-shadow: 0 8px 16px rgba(8, 174, 234, 0.22);
  font-weight: 900;
}

.analysis-run:disabled {
  opacity: 0.65;
}

.analysis-box {
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid #dbe6ef;
  border-radius: 8px;
  background: #fff;
}

.analysis-box-title {
  min-height: 38px;
  padding: 11px 14px;
  border-bottom: 1px solid #e8eef5;
  color: #111923;
  background: #f8fafc;
  font-weight: 900;
}

.analysis-box-title::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 18px;
  margin-right: 10px;
  border-radius: 3px;
  vertical-align: -4px;
  background: #08aeea;
}

.analysis-number-grid {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 6px;
  padding: 12px;
}

.analysis-number {
  height: 40px;
  border: 1px solid #e0e7ef;
  border-radius: 7px;
  color: #111923;
  background: #f4f7fb;
  font-weight: 900;
  font-size: 15px;
}

.analysis-number.active {
  border-color: #08aeea;
  color: #fff;
  background: #08aeea;
  box-shadow: 0 8px 18px rgba(8, 174, 234, 0.28);
}

.analysis-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  margin-top: 12px;
  padding: 0 14px;
  border: 1px solid #ccedf8;
  border-radius: 8px;
  color: #536174;
  background: #f4fcff;
  font-size: 13px;
}

.analysis-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #5bc7ed;
}

.analysis-empty {
  padding: 22px;
  color: #64748b;
  text-align: center;
}

.analysis-core-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px 8px;
}

.analysis-core-head > div {
  display: grid;
  gap: 3px;
}

.analysis-core-head strong {
  color: #111923;
  font-size: 18px;
}

.analysis-core-head small {
  color: #64748b;
}

.analysis-core-head b {
  color: #08aeea;
}

.analysis-core-head em {
  margin-left: auto;
  min-width: 62px;
  padding: 3px 8px;
  border-radius: 5px;
  background: #e9eff6;
  color: #64748b;
  font-style: normal;
  font-weight: 900;
  text-align: center;
}

.analysis-core-head em.up {
  color: #ef4444;
  background: #ffe8ec;
}

.analysis-core-head em.down {
  color: #64748b;
}

.analysis-number-ball {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: #fff;
  background: #08aeea;
  font-size: 22px;
  font-weight: 900;
}

.analysis-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 12px 12px;
}

.analysis-metric {
  min-height: 72px;
  padding: 10px 12px;
  border: 1px solid #e3ebf3;
  border-radius: 5px;
  background: #fbfcfe;
}

.analysis-metric span {
  display: block;
  color: #536174;
  font-size: 13px;
}

.analysis-metric strong {
  display: block;
  margin-top: 5px;
  color: #08aeea;
  font-size: 18px;
  font-weight: 900;
}

.analysis-metric strong small {
  margin-left: 2px;
  color: #536174;
  font-size: 12px;
}

.analysis-metric > small {
  display: block;
  margin-top: 3px;
  color: #64748b;
}

.analysis-next-label {
  padding: 16px 12px 8px;
  color: #536174;
  font-size: 13px;
  font-weight: 900;
}

.analysis-option-grid {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.analysis-option-grid.two {
  grid-template-columns: repeat(4, 1fr);
}

.analysis-option-grid.four {
  grid-template-columns: repeat(4, 1fr);
}

.analysis-option {
  position: relative;
  overflow: hidden;
  min-height: 92px;
  padding: 13px 14px 18px;
  border: 1px solid #e1e8f0;
  border-radius: 12px;
  background: #fff;
}

.analysis-option span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 900;
}

.analysis-option span i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.analysis-option strong {
  display: block;
  margin-top: 5px;
  font-size: 30px;
  line-height: 1;
  font-weight: 900;
}

.analysis-option small {
  display: block;
  margin-top: 4px;
  color: #536174;
}

.analysis-option em {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 5px;
  border-radius: 0 5px 5px 0;
}

.analysis-option.red span,
.analysis-option.red strong {
  color: #ef4444;
}

.analysis-option.red span i,
.analysis-option.red em {
  background: #ef4444;
}

.analysis-option.blue span,
.analysis-option.blue strong {
  color: #3478f6;
}

.analysis-option.blue span i,
.analysis-option.blue em {
  background: #3478f6;
}

.analysis-option.purple {
  border-color: #c084fc;
  background: #fdfaff;
}

.analysis-option.purple span,
.analysis-option.purple strong {
  color: #a855f7;
}

.analysis-option.purple span i,
.analysis-option.purple em {
  background: #a855f7;
}

.analysis-option.rose {
  border-color: #fecdd3;
  background: #fffbfc;
}

.analysis-option.rose span,
.analysis-option.rose strong {
  color: #ef4444;
}

.analysis-option.rose span i,
.analysis-option.rose em {
  background: #f9a8d4;
}

.analysis-option.cyan {
  border-color: #38bdf8;
  background: #f6fdff;
}

.analysis-option.cyan span,
.analysis-option.cyan strong {
  color: #08aeea;
}

.analysis-option.cyan span i,
.analysis-option.cyan em {
  background: #08aeea;
}

.analysis-option.gold {
  border-color: #fde68a;
  background: #fffdf7;
}

.analysis-option.gold span,
.analysis-option.gold strong {
  color: #f59e0b;
}

.analysis-option.gold span i,
.analysis-option.gold em {
  background: #f59e0b;
}

.analysis-abc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 14px 12px;
}

.analysis-abc-col > strong {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
}

.analysis-abc-col.red > strong {
  color: #ef4444;
}

.analysis-abc-col.blue > strong {
  color: #3478f6;
}

.analysis-abc-col.green > strong {
  color: #10b981;
}

.analysis-bar-row {
  display: grid;
  grid-template-columns: 18px 1fr 28px 46px;
  align-items: center;
  gap: 8px;
  min-height: 19px;
  color: #536174;
  font-size: 12px;
}

.analysis-bar-row span,
.analysis-bar-row b {
  color: #08aeea;
  font-weight: 900;
}

.analysis-bar-row em {
  height: 16px;
  overflow: hidden;
  border-radius: 4px;
  background: #f2f5f8;
}

.analysis-bar-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #ef4444;
}

.analysis-abc-col.blue .analysis-bar-row i {
  background: #3478f6;
}

.analysis-abc-col.green .analysis-bar-row i {
  background: #20c997;
}

.analysis-relation-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding: 14px 12px 6px;
}

.analysis-relation-grid h4,
.analysis-top-title {
  margin: 0 0 8px;
  color: #536174;
  font-size: 13px;
}

.analysis-mini-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.analysis-mini-badge {
  display: inline-grid;
  gap: 2px;
  min-width: 34px;
  padding: 5px 7px;
  border: 1px solid #e1e8f0;
  border-radius: 6px;
  background: #f8fbff;
  text-align: center;
}

.analysis-mini-badge strong {
  color: #08aeea;
  font-size: 14px;
}

.analysis-mini-badge small,
.analysis-muted {
  color: #64748b;
  font-size: 12px;
}

.analysis-top-title {
  padding: 8px 12px 0;
}

.analysis-deviation-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding: 8px 12px 14px;
}

.analysis-deviation-card {
  min-height: 72px;
  padding: 10px;
  border: 1px solid #dbe6ef;
  border-radius: 10px;
  text-align: center;
}

.analysis-deviation-card strong,
.analysis-deviation-card b,
.analysis-deviation-card span {
  display: block;
}

.analysis-deviation-card strong {
  color: #111923;
  font-size: 16px;
}

.analysis-deviation-card b {
  margin-top: 5px;
  color: #ef4444;
}

.analysis-deviation-card.cold b {
  color: #3478f6;
}

.analysis-deviation-card span {
  margin-top: 4px;
  color: #536174;
  font-size: 12px;
}

.opened-stats-panel {
  min-width: 980px;
  padding: 16px;
  background: #fff;
}

.opened-stats-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border-radius: 10px;
  background: #f8fbfe;
  box-shadow: inset 0 0 0 1px #e6eef6;
}

.opened-stats-head h3 {
  margin: 0 0 4px;
  color: #111923;
  font-size: 16px;
}

.opened-stats-head p {
  margin: 0;
  color: #536174;
  font-size: 13px;
}

.opened-date-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr)) minmax(150px, auto);
  align-items: center;
  gap: 10px;
  flex: 1;
  max-width: 820px;
}

.opened-date-controls button,
.opened-date-controls label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #536174;
  background: transparent;
  font-weight: 900;
}

.opened-date-controls button.active {
  color: #fff;
  background: #08aeea;
  box-shadow: 0 8px 18px rgba(8, 174, 234, 0.2);
}

.opened-date-controls label {
  gap: 7px;
  border-color: #d7e3ee;
  background: #fff;
}

.opened-date-controls input {
  width: 120px;
  border: 0;
  color: #111923;
  background: transparent;
  font: inherit;
  font-weight: 900;
}

.opened-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  margin-top: 12px;
  padding: 0 14px;
  border: 1px solid #ccedf8;
  border-radius: 8px;
  color: #536174;
  background: #f4fcff;
  font-size: 13px;
}

.opened-total-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 50px;
  margin-top: 12px;
  padding: 0 16px;
  border-radius: 8px;
  color: #536174;
  background: #f8fafc;
  box-shadow: inset 0 -1px 0 #e8eef5;
}

.opened-total-card strong {
  color: #08aeea;
  font-size: 22px;
  font-weight: 900;
}

.opened-section {
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid #dbe6ef;
  border-radius: 8px;
  background: #fff;
}

.opened-section h4 {
  min-height: 38px;
  margin: 0;
  padding: 11px 14px;
  border-bottom: 1px solid #e8eef5;
  color: #111923;
  background: #f8fafc;
  font-size: 15px;
}

.opened-section h4::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 18px;
  margin-right: 10px;
  border-radius: 3px;
  vertical-align: -4px;
  background: #08aeea;
}

.opened-grid {
  display: grid;
  background: #edf3f8;
  gap: 1px;
}

.opened-grid.cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.opened-grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.opened-grid.cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.opened-cell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  min-height: 42px;
  padding: 6px 16px;
  background: #fff;
}

.opened-cell:nth-child(even) {
  background: #f7fcff;
}

.opened-cell.empty {
  min-height: 42px;
}

.opened-cell > span {
  text-align: center;
}

.opened-cell strong {
  color: #08aeea;
  font-size: 16px;
  font-weight: 900;
  text-align: center;
}

.opened-cell small {
  margin-left: 2px;
  color: #536174;
  font-size: 12px;
  font-weight: 600;
}

.opened-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 24px;
  padding: 0 8px;
  border-radius: 7px;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.opened-badge.blue {
  background: #0b86ef;
}

.opened-badge.red {
  background: #ff2938;
}

.opened-badge.cyan {
  background: #08aeea;
}

.opened-badge.green {
  background: #00b47a;
}

.opened-badge.orange {
  background: #ff7417;
}

.opened-badge.purple {
  background: #a855f7;
}

.opened-badge.gold {
  background: #f59e0b;
}

.opened-badge.gray {
  background: #64748b;
}

@media (max-width: 760px) {
  .number-analysis-panel {
    min-width: 0;
    padding: 10px;
  }

  .analysis-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
  }

  .analysis-controls {
    width: 100%;
  }

  .analysis-controls input {
    flex: 1;
    min-width: 0;
  }

  .analysis-number-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .analysis-metric-grid,
  .analysis-option-grid.two,
  .analysis-option-grid.four,
  .analysis-abc-grid,
  .analysis-relation-grid,
  .analysis-deviation-grid {
    grid-template-columns: 1fr;
  }

  .analysis-option {
    min-height: 82px;
  }

  .analysis-option strong {
    font-size: 26px;
  }

  .analysis-bar-row {
    grid-template-columns: 18px 1fr 24px 40px;
  }

  .opened-stats-panel {
    min-width: 0;
    padding: 10px;
  }

  .opened-stats-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .opened-date-controls {
    width: 100%;
    grid-template-columns: repeat(3, 1fr);
  }

  .opened-date-controls label {
    grid-column: 1 / -1;
  }

  .opened-grid.cols-2,
  .opened-grid.cols-3,
  .opened-grid.cols-4 {
    grid-template-columns: 1fr;
  }

  .opened-cell {
    grid-template-columns: 0.8fr 1fr;
  }
}

body.layout-mobile .number-analysis-panel {
  min-width: 0;
  padding: 10px;
}

body.layout-mobile .analysis-toolbar {
  align-items: flex-start;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
}

body.layout-mobile .analysis-controls {
  width: 100%;
}

body.layout-mobile .analysis-controls input {
  flex: 1;
  min-width: 0;
}

body.layout-mobile .analysis-number-grid {
  grid-template-columns: repeat(4, 1fr);
}

body.layout-mobile .analysis-metric-grid,
body.layout-mobile .analysis-option-grid.two,
body.layout-mobile .analysis-option-grid.four,
body.layout-mobile .analysis-abc-grid,
body.layout-mobile .analysis-relation-grid,
body.layout-mobile .analysis-deviation-grid {
  grid-template-columns: 1fr;
}

body.layout-mobile .analysis-option {
  min-height: 82px;
}

body.layout-mobile .analysis-option strong {
  font-size: 26px;
}

body.layout-mobile .analysis-bar-row {
  grid-template-columns: 18px 1fr 24px 40px;
}

body.layout-mobile .opened-stats-panel {
  min-width: 0;
  padding: 10px;
}

body.layout-mobile .opened-stats-head {
  align-items: flex-start;
  flex-direction: column;
}

body.layout-mobile .opened-date-controls {
  width: 100%;
  grid-template-columns: repeat(3, 1fr);
}

body.layout-mobile .opened-date-controls label {
  grid-column: 1 / -1;
}

body.layout-mobile .opened-grid.cols-2,
body.layout-mobile .opened-grid.cols-3,
body.layout-mobile .opened-grid.cols-4 {
  grid-template-columns: 1fr;
}

body.layout-mobile .opened-cell {
  grid-template-columns: 0.8fr 1fr;
}

.keno-info {
  margin: 16px 16px 6px;
  padding: 13px 16px;
  border-radius: 8px;
  color: #536174;
  background: #f4f8fb;
  font-size: 13px;
  line-height: 1.8;
}

.keno-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 2px 16px 12px;
  color: #5f6f82;
  font-size: 13px;
}

.keno-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.keno-dot {
  width: 10px;
  height: 10px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.keno-dot.orange {
  color: #ff7a2f;
}

.keno-dot.green {
  color: #20c997;
}

.keno-dot.purple {
  color: #8b5cf6;
}

.keno-list {
  display: grid;
  min-width: 1080px;
}

.keno-row {
  display: grid;
  grid-template-columns: minmax(720px, 1fr) max-content;
  grid-template-areas:
    "meta result"
    "balls result"
    "process process";
  align-items: start;
  column-gap: 26px;
  row-gap: 12px;
  min-height: 112px;
  padding: 25px 38px 15px 28px;
  border-top: 1px solid #eef4f8;
}

.keno-row:nth-child(odd) {
  background: #f8fdff;
}

.keno-row:nth-child(even) {
  background: #fff;
}

.keno-meta {
  grid-area: meta;
  display: flex;
  align-items: baseline;
  gap: 7px;
  white-space: nowrap;
}

.keno-meta strong {
  color: #111923;
  font-weight: 900;
}

.keno-meta span {
  color: #66758a;
  font-size: 13px;
}

.keno-balls {
  grid-area: balls;
  display: flex;
  flex-wrap: nowrap;
  align-items: end;
  gap: 5px;
  min-width: 0;
}

.keno-ball-wrap {
  display: grid;
  justify-items: center;
  flex: 0 0 31px;
  min-width: 31px;
}

.keno-position {
  height: 14px;
  font-size: 11px;
  line-height: 14px;
  font-weight: 800;
}

.keno-position.orange,
.keno-ball.orange {
  color: #ff6f20;
}

.keno-position.green,
.keno-ball.green {
  color: #0aa574;
}

.keno-position.purple,
.keno-ball.purple {
  color: #7c3cff;
}

.keno-ball {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
  font-weight: 900;
  box-shadow: inset 0 0 0 2px currentColor;
}

.keno-ball.neutral {
  color: #66758a;
  background: #f7fafc;
  box-shadow: inset 0 0 0 2px #d9e4ee;
}

.keno-result {
  grid-area: result;
  display: flex;
  align-items: center;
  align-self: start;
  justify-self: end;
  gap: 12px;
  white-space: nowrap;
}

.keno-formula {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #111923;
  font-weight: 900;
}

.keno-sum {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 26px;
  border-radius: 6px;
  color: #fff;
  background: #08aeea;
  font-weight: 900;
}

.keno-toggle {
  padding: 0;
  border: 0;
  color: #079fe0;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.keno-toggle:hover {
  color: #047eb0;
}

.keno-row.is-expanded {
  align-items: start;
  background: #eefaff;
}

.keno-process-panel {
  grid-area: process;
  display: grid;
  gap: 8px;
  margin-top: 0;
  padding: 12px 14px 14px;
  border: 1px solid #d9ecf5;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.keno-calc-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  min-height: 27px;
  color: #536174;
  font-size: 13px;
  font-weight: 700;
}

.keno-calc-label {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 5px;
  font-weight: 900;
}

.keno-calc-row.orange .keno-calc-label {
  color: #ff6f20;
  background: #fff0e6;
}

.keno-calc-row.green .keno-calc-label {
  color: #0aa574;
  background: #dcf8ed;
}

.keno-calc-row.purple .keno-calc-label {
  color: #7c3cff;
  background: #f0e7ff;
}

.keno-calc-desc,
.keno-calc-tail {
  white-space: nowrap;
}

.keno-calc-formula {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  color: #111923;
  font-weight: 900;
}

.keno-calc-plus,
.keno-calc-equals {
  color: #536174;
  font-weight: 800;
}

.keno-calc-formula .orange,
.keno-calc-total .orange {
  color: #ff5b18;
}

.keno-calc-formula .green,
.keno-calc-total .green {
  color: #00a878;
}

.keno-calc-formula .purple,
.keno-calc-total .purple {
  color: #7c3cff;
}

.keno-calc-total-num {
  color: #111923;
}

.keno-calc-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  color: #fff;
  font-weight: 900;
}

.keno-calc-row.orange .keno-calc-value {
  background: #ff6f20;
}

.keno-calc-row.green .keno-calc-value {
  background: #00b47a;
}

.keno-calc-row.purple .keno-calc-value {
  background: #7c3cff;
}

.keno-calc-total {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 38px;
  margin-top: 3px;
  border-radius: 8px;
  color: #536174;
  background: #d8f5fb;
  font-size: 14px;
  font-weight: 800;
}

.keno-calc-total > strong:last-child {
  color: #079fe0;
  font-size: 16px;
}

@media (max-width: 760px) {
  .keno-info {
    margin: 12px;
    padding: 11px 12px;
    font-size: 12px;
  }

  .keno-legend {
    justify-content: flex-start;
    gap: 8px 12px;
    padding: 0 12px 10px;
    font-size: 12px;
  }

  .keno-list {
    min-width: 0;
  }

  .keno-row {
    grid-template-columns: 1fr;
    grid-template-areas:
      "meta"
      "balls"
      "result"
      "process";
    gap: 10px;
    padding: 12px;
  }

  .keno-meta {
    justify-content: space-between;
  }

  .keno-balls {
    flex-wrap: wrap;
    gap: 3px 5px;
  }

  .keno-ball-wrap {
    min-width: 27px;
  }

  .keno-ball {
    width: 26px;
    height: 26px;
    font-size: 12px;
  }

  .keno-result {
    justify-self: start;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .keno-process-panel {
    padding: 10px;
  }

  .keno-calc-row {
    gap: 5px;
    font-size: 12px;
  }

  .keno-calc-formula {
    flex-basis: 100%;
  }

  .keno-calc-total {
    justify-content: flex-start;
    padding: 0 10px;
  }
}

body.layout-mobile .keno-list {
  min-width: 0;
}

body.layout-mobile .keno-row {
  grid-template-columns: 1fr;
  grid-template-areas:
    "meta"
    "balls"
    "result"
    "process";
  gap: 10px;
  padding: 12px;
}

body.layout-mobile .keno-meta {
  justify-content: space-between;
}

body.layout-mobile .keno-balls {
  flex-wrap: wrap;
  gap: 3px 5px;
}

body.layout-mobile .keno-ball-wrap {
  min-width: 27px;
}

body.layout-mobile .keno-ball {
  width: 26px;
  height: 26px;
  font-size: 12px;
}

body.layout-mobile .keno-result {
  justify-self: start;
  justify-content: flex-start;
  flex-wrap: wrap;
}

body.layout-mobile .keno-process-panel {
  padding: 10px;
}

body.layout-mobile .keno-calc-row {
  gap: 5px;
  font-size: 12px;
}

body.layout-mobile .keno-calc-formula {
  flex-basis: 100%;
}

body.layout-mobile .keno-calc-total {
  justify-content: flex-start;
  padding: 0 10px;
}

.dragon-panel {
  padding: 16px;
  background: #fff;
}

.dragon-alert {
  display: flex;
  align-items: center;
  min-height: 42px;
  margin-bottom: 12px;
  padding: 0 14px;
  border: 1px solid #d5edf8;
  border-radius: 8px;
  color: #46566a;
  background: #f7fdff;
  font-size: 13px;
  font-weight: 700;
}

.dragon-alert::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-right: 10px;
  border-radius: 50%;
  background: #08aeea;
}

.dragon-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.dragon-card {
  display: grid;
  gap: 10px;
  min-height: 160px;
  overflow: hidden;
  border: 1px solid #dce8ef;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 5px 14px rgba(37, 87, 128, 0.06);
}

.dragon-card.active {
  border-color: #85dfaf;
  background: #f4fff8;
}

.dragon-card-head {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 0;
}

.dragon-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: #5d6b7c;
  background: #edf3f8;
  font-size: 17px;
  font-weight: 900;
}

.dragon-card-head strong {
  color: #111923;
  font-size: 15px;
  font-weight: 900;
}

.dragon-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  color: #475569;
  background: #eef3f7;
  font-size: 12px;
  font-weight: 800;
}

.dragon-status.live {
  color: #00a855;
  background: #ddfbe9;
}

.dragon-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
}

.dragon-mode,
.dragon-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 23px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.dragon-mode {
  color: #fff;
}

.dragon-mode.green {
  background: #10c867;
}

.dragon-mode.blue {
  background: #2f80ed;
}

.dragon-mode.purple {
  background: #a855f7;
}

.dragon-count {
  color: #162231;
  background: #fff;
  box-shadow: inset 0 0 0 1px #cfd9e4;
}

.dragon-progress {
  height: 5px;
  margin: 0 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #c8f0fb;
}

.dragon-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #9aa4b2;
}

.dragon-card.active .dragon-progress span {
  background: #10c867;
}

.dragon-sequence {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 37px;
  padding: 8px 12px;
  border-top: 1px solid #e1ebf2;
  background: rgba(248, 251, 254, 0.78);
}

.dragon-seq-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 6px;
  border-radius: 5px;
  color: #566579;
  background: #eef2f6;
  font-size: 12px;
  font-weight: 900;
}

.dragon-seq-badge.red {
  color: #ff2639;
  background: #ffe4e7;
}

.dragon-seq-badge.blue {
  color: #247bff;
  background: #e4efff;
}

.dragon-seq-badge.green {
  color: #0aa355;
  background: #e2f9ea;
}

.dragon-seq-badge.cyan {
  color: #0891b2;
  background: #e0f8ff;
}

.dragon-seq-badge.violet,
.dragon-seq-badge.purple {
  color: #8b5cf6;
  background: #f0e8ff;
}

.dragon-seq-badge.gray {
  color: #64748b;
  background: #eef2f6;
}

.dragon-predict {
  margin-left: 2px;
  font-size: 12px;
  font-weight: 900;
}

.dragon-predict.red {
  color: #ff2639;
}

.dragon-predict.blue {
  color: #247bff;
}

.dragon-predict.green {
  color: #0aa355;
}

.dragon-predict.cyan {
  color: #0891b2;
}

.dragon-predict.violet,
.dragon-predict.purple {
  color: #8b5cf6;
}

.dragon-issues {
  padding: 0 12px 12px;
  color: #66758a;
  font-size: 12px;
  font-weight: 900;
}

@media (max-width: 960px) {
  .dragon-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .dragon-panel {
    padding: 12px;
  }

  .dragon-grid {
    grid-template-columns: 1fr;
  }
}

body.layout-mobile .dragon-panel {
  padding: 12px;
}

body.layout-mobile .dragon-grid {
  grid-template-columns: 1fr;
}

.placeholder-panel {
  padding: 34px 20px;
  color: #64748b;
  text-align: center;
  font-weight: 700;
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background: linear-gradient(180deg, #f5f9fc 0%, #f1f6fa 46%, #f7fafc 100%);
}

.login-card {
  display: grid;
  gap: 16px;
  width: min(100%, 390px);
  padding: 28px;
  border: 1px solid #dbe6ef;
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  font-size: 22px;
}

.login-card label {
  display: grid;
  gap: 7px;
  color: #526173;
  font-weight: 800;
}

.login-card input {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #d5e0ea;
  border-radius: 8px;
}

.login-card input:focus {
  outline: 2px solid rgba(37, 129, 220, 0.18);
  border-color: #70b6eb;
}

.login-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  color: #b42318;
  background: #fff0f0;
  font-weight: 800;
}

.login-back {
  color: #2581dc;
  text-align: center;
  text-decoration: none;
  font-weight: 800;
}

.login-card .admin-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.member-auth-page {
  place-items: start center;
  align-content: start;
  padding: 74px 20px 32px;
}

.member-auth-card {
  display: grid;
  gap: 17px;
  width: min(100%, 360px);
}

.member-auth-head {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-bottom: 6px;
  text-align: center;
}

.member-auth-title-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.member-auth-title-line .brand-mark {
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  font-size: 11px;
}

.member-auth-title-line h1 {
  margin: 0;
  color: #0f1826;
  font-size: 21px;
  line-height: 1.2;
  font-weight: 900;
}

.member-auth-head p {
  margin: 0;
  color: #526273;
  font-size: 14px;
}

.member-auth-field {
  display: grid;
  gap: 9px;
  color: #0f1826;
  font-size: 14px;
  font-weight: 700;
}

.member-auth-field > input,
.password-input input {
  width: 100%;
  min-height: 43px;
  box-sizing: border-box;
  padding: 0 14px;
  border: 1px solid #d6e0ea;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
  color: #152233;
  font: inherit;
  font-weight: 500;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.member-auth-field > input:focus,
.password-input input:focus {
  outline: 0;
  border-color: #12aee7;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 0 0 2px rgba(18, 174, 231, 0.14);
}

.password-input {
  position: relative;
  display: block;
}

.password-input input {
  padding-right: 44px;
}

.password-input button {
  position: absolute;
  top: 50%;
  right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #65758a;
  transform: translateY(-50%);
  cursor: pointer;
}

.password-input svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.member-auth-agree {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #566575;
  font-size: 13px;
  line-height: 1.4;
}

.member-auth-agree input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: #168eea;
}

.member-auth-agree a {
  color: #00a7e8;
  text-decoration: none;
  font-weight: 800;
}

.member-auth-submit {
  min-height: 40px;
  border: 0;
  border-radius: 7px;
  background: #12aee3;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(18, 174, 227, 0.18);
}

.member-auth-switch {
  margin: 8px 0 0;
  color: #667589;
  text-align: center;
  font-size: 14px;
}

.member-auth-switch a {
  margin-left: 8px;
  color: #00a7e8;
  text-decoration: none;
  font-weight: 800;
}

.member-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 4px;
  border: 1px solid #dbe6ef;
  border-radius: 10px;
  background: #f4f8fc;
}

.member-tabs a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: #526173;
  text-decoration: none;
  font-weight: 900;
}

.member-tabs a.active {
  color: #fff;
  background: #2581dc;
  box-shadow: 0 8px 18px rgba(37, 129, 220, 0.2);
}

.member-profile,
.member-meta {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid #dbe6ef;
  border-radius: 10px;
  background: #f8fbfe;
}

.member-profile span,
.member-meta span {
  color: #64748b;
  font-weight: 800;
}

.member-profile strong {
  color: #142231;
  font-size: 24px;
}

.member-meta strong {
  color: #142231;
}

.header-button.is-member {
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.2);
}

.admin-user {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: rgba(255, 255, 255, 0.88);
  font-weight: 700;
}

.admin-shell {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  align-items: start;
  gap: 18px;
}

.admin-sidebar {
  position: sticky;
  top: 72px;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #dbe6ef;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.sidebar-title {
  padding: 4px 6px;
  color: #708195;
  font-size: 13px;
  font-weight: 900;
}

.sidebar-nav {
  display: grid;
  gap: 8px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #304456;
  text-decoration: none;
  font-weight: 900;
}

.sidebar-link svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.sidebar-link:hover,
.sidebar-link.active {
  color: #086dbb;
  border-color: #bfe5fb;
  background: linear-gradient(135deg, #edf9ff, #f8fcff);
}

.admin-content {
  display: grid;
  min-width: 0;
  gap: 18px;
}

.admin-content > .admin-panel {
  min-height: 560px;
}

.admin-panel {
  scroll-margin-top: 92px;
  padding: 22px;
  border: 1px solid #dbe6ef;
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
}

.admin-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.admin-title h1 {
  margin: 0 0 7px;
  font-size: 24px;
}

.admin-title p {
  margin: 0;
  color: #66788a;
}

.admin-actions {
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
}

.admin-button {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid #1b7ed7;
  border-radius: 8px;
  color: #fff;
  background: #2581dc;
  font-weight: 800;
}

.admin-button.secondary {
  color: #304456;
  border-color: #d8e2ec;
  background: #f5f8fb;
}

.ad-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.ad-editor {
  display: grid;
  gap: 13px;
  margin: 0;
  padding: 18px;
  border: 1px solid #dbe6ef;
  border-radius: 10px;
  background: #f9fcff;
}

.site-editor {
  grid-column: 1 / -1;
}

.ad-editor legend {
  padding: 0 8px;
  color: #111827;
  font-weight: 900;
}

.ad-editor label {
  display: grid;
  gap: 6px;
  color: #526173;
  font-weight: 700;
}

.ad-editor input[type="text"],
.ad-editor input[type="url"],
.ad-editor textarea {
  width: 100%;
  border: 1px solid #d5e0ea;
  border-radius: 8px;
  color: #142231;
  background: #fff;
}

.ad-editor input[type="text"],
.ad-editor input[type="url"] {
  min-height: 38px;
  padding: 0 11px;
}

.ad-editor textarea {
  min-height: 112px;
  padding: 10px 11px;
  resize: vertical;
  line-height: 1.6;
  font: inherit;
}

.ad-editor input:focus {
  outline: 2px solid rgba(37, 129, 220, 0.18);
  border-color: #70b6eb;
}

.api-form {
  display: grid;
  gap: 16px;
}

.api-config-block {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #dbe8f3;
  border-radius: 10px;
  background: #f8fcff;
}

.api-block-title h2 {
  margin: 0 0 4px;
  color: #0f1826;
  font-size: 17px;
}

.api-block-title p {
  margin: 0;
  color: #66788a;
  font-size: 13px;
  line-height: 1.7;
}

.api-url-table {
  display: grid;
  border: 1px solid #e6ebf1;
  background: #fff;
}

.api-url-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 142px;
  min-height: 52px;
  border-bottom: 1px solid #edf1f5;
}

.api-url-row:last-child {
  border-bottom: 0;
}

.api-url-row > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid #edf1f5;
  color: #263546;
  font-weight: 800;
}

.api-url-row input {
  min-width: 0;
  padding: 0 14px;
  border: 0;
  color: #0f1826;
  font: inherit;
}

.api-url-row input:focus {
  outline: 2px solid rgba(18, 174, 231, 0.18);
  outline-offset: -2px;
}

.api-copy-button {
  border: 0;
  color: #fff;
  background: #a832cc;
  font-weight: 900;
  cursor: pointer;
}

.api-test-button {
  min-height: 40px;
  border: 0;
  border-radius: 2px;
  color: #fff;
  background: #209cec;
  font-weight: 900;
  cursor: pointer;
}

.api-test-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.api-result-panel {
  border: 1px solid #e6ebf1;
  background: #fff;
}

.api-result-tabs {
  display: flex;
  border-bottom: 1px solid #e6ebf1;
  background: #fafafa;
}

.api-result-tabs button {
  min-width: 94px;
  min-height: 40px;
  border: 0;
  border-right: 1px solid #e6ebf1;
  color: #526173;
  background: transparent;
  font-weight: 800;
  cursor: pointer;
}

.api-result-tabs button.active {
  color: #111827;
  background: #fff;
}

.api-raw-output {
  margin: 16px;
  min-height: 86px;
  padding: 18px;
  border-left: 5px solid #22c778;
  color: #263546;
  background: #fbfcfe;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.75;
}

.api-format-output {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.api-format-output:not(.hidden) {
  display: grid;
}

.api-format-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid #e1eaf2;
  border-radius: 10px;
  background: #f8fbfe;
}

.api-format-card span {
  color: #66788a;
  font-size: 13px;
  font-weight: 800;
}

.api-format-card strong {
  color: #0f1826;
  font-size: 18px;
}

@media (max-width: 760px) {
  .api-url-row {
    grid-template-columns: 82px minmax(0, 1fr) 70px;
  }

  .api-url-row input {
    padding: 0 9px;
    font-size: 12px;
  }

  .api-format-output:not(.hidden) {
    grid-template-columns: 1fr;
  }

  .api-raw-output {
    margin: 10px;
    padding: 12px;
    font-size: 12px;
  }
}

.switch-line {
  display: flex !important;
  grid-template-columns: none;
  align-items: center;
  gap: 9px !important;
  color: #1c2b3a !important;
}

.switch-line input {
  width: 18px;
  height: 18px;
  accent-color: #2581dc;
}

.save-message {
  min-height: 22px;
  margin: 16px 0 0;
  color: #0f8a55;
  font-weight: 800;
}

.admin-toast {
  position: fixed;
  right: 26px;
  bottom: 26px;
  z-index: 50;
  max-width: min(420px, calc(100vw - 32px));
  padding: 14px 18px;
  border: 1px solid #b7ecd1;
  border-radius: 12px;
  color: #087443;
  background: linear-gradient(135deg, #ecfff5, #dffbea);
  box-shadow: 0 18px 42px rgba(8, 116, 67, 0.18);
  font-weight: 900;
  animation: toastIn 0.22s ease-out;
}

.admin-toast.error {
  color: #b42318;
  border-color: #ffd0d0;
  background: linear-gradient(135deg, #fff6f6, #ffecec);
  box-shadow: 0 18px 42px rgba(180, 35, 24, 0.16);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.member-count {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #dbe6ef;
  border-radius: 999px;
  color: #2581dc;
  background: #f4f9ff;
  font-weight: 900;
}

.visitor-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.visitor-stat-card {
  display: grid;
  gap: 7px;
  padding: 14px;
  border: 1px solid #dbe6ef;
  border-radius: 10px;
  background: linear-gradient(180deg, #f8fcff, #fff);
}

.visitor-stat-card span {
  color: #66788a;
  font-size: 13px;
  font-weight: 800;
}

.visitor-stat-card strong {
  color: #0f1826;
  font-size: 22px;
  line-height: 1.15;
}

.visitor-table {
  min-width: 1120px;
}

.visitor-table td:nth-child(1) {
  color: #0f1826;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 120px;
  border: 1px dashed #cbd8e4;
  border-radius: 10px;
  color: #64748b;
  background: #f8fbfe;
  font-weight: 800;
}

.member-table-wrap {
  overflow-x: auto;
  border: 1px solid #dbe6ef;
  border-radius: 10px;
}

.member-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  color: #263546;
  font-size: 14px;
}

.member-table th,
.member-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #e8eef4;
  text-align: left;
  vertical-align: middle;
}

.member-table th {
  color: #596b7f;
  background: #f3f7fb;
  font-weight: 900;
}

.member-table tbody tr:last-child td {
  border-bottom: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-weight: 900;
}

.status-pill.active {
  color: #0f8a55;
  background: #e8f8f0;
}

.status-pill.blocked {
  color: #b42318;
  background: #fff0f0;
}

.member-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.member-actions form {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin: 0;
}

.password-reset-form input {
  width: 108px;
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid #d5e0ea;
  border-radius: 7px;
}

.mini-button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #cbd8e4;
  border-radius: 7px;
  color: #304456;
  background: #f6f9fc;
  font-weight: 900;
}

.mini-button.primary {
  color: #fff;
  border-color: #2581dc;
  background: #2581dc;
}

.mini-button.danger {
  color: #b42318;
  border-color: #ffd0d0;
  background: #fff5f5;
}

.hit-ok,
.predict-red,
.miss-hot {
  color: var(--danger);
  font-weight: 900;
}

.hit-bad,
.pending {
  color: #0b86ef;
  font-weight: 900;
}

@media (max-width: 900px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
  }

  .sidebar-title {
    display: none;
  }

  .sidebar-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar-link {
    justify-content: center;
  }

  .admin-content > .admin-panel {
    min-height: 0;
  }

  .top-ad {
    grid-template-columns: 96px 1fr;
    min-height: 108px;
  }

  .ad-cta {
    grid-column: 2;
    justify-self: start;
    min-width: auto;
    min-height: 34px;
    padding: 0 14px;
    font-size: 20px;
  }

  .ad-emblem {
    width: 82px;
    height: 70px;
    font-size: 25px;
  }

  .ad-form {
    grid-template-columns: 1fr;
  }

  .visitor-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .insight-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .draw-main {
    grid-template-columns: 1fr;
    margin-top: 28px;
  }

  .timer-block,
  .result-shell {
    width: min(100%, 400px);
    justify-self: center;
  }

  .view-tabs {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 560px) {
  .app-header {
    position: relative;
    top: auto;
    width: min(100%, 430px);
    height: auto;
    margin: 0 auto;
  }

  .header-inner {
    align-items: center;
    flex-direction: row;
    gap: 8px;
    height: 62px;
    padding: 0 12px;
  }

  .header-actions {
    justify-content: flex-end;
  }

  .brand {
    min-width: 0;
    font-size: 17px;
  }

  .brand-mark {
    width: 26px;
    height: 26px;
    font-size: 10px;
  }

  .header-button {
    min-height: 36px;
    padding: 0 12px;
    white-space: nowrap;
  }

  .page-shell {
    width: min(100%, 430px);
    margin-top: 0;
    padding: 10px 10px 22px;
    border: 1px solid #d8e7f2;
    border-top: 0;
    background: #fff;
    box-shadow: 0 12px 34px rgba(44, 92, 133, 0.12);
  }

  .top-ad {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 7px;
    min-height: 42px;
    padding: 5px 8px;
    border-radius: 5px;
  }

  .ad-emblem {
    width: 36px;
    height: 30px;
    border-width: 2px;
    border-radius: 7px;
    font-size: 14px;
  }

  .ad-copy strong {
    font-size: 13px;
    line-height: 1.1;
  }

  .ad-copy span {
    font-size: 11px;
    line-height: 1.1;
  }

  .ad-cta {
    grid-column: 3;
    align-self: center;
    justify-self: end;
    min-height: 24px;
    min-width: auto;
    padding: 0 8px;
    border-radius: 13px;
    font-size: 18px;
  }

  .admin-title {
    flex-direction: column;
  }

  .admin-actions {
    width: 100%;
  }

  .admin-button {
    flex: 1;
  }

  .admin-toast {
    right: 14px;
    bottom: 14px;
  }

  .draw-card {
    padding: 22px 14px;
  }

  .draw-header {
    align-items: flex-start;
  }

  .latest-line {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .draw-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .timer-block {
    gap: 20px;
  }

  .num-ball {
    width: 46px;
    height: 46px;
    font-size: 28px;
  }

  .number-block {
    gap: 8px;
  }

  .insight-grid {
    grid-template-columns: 1fr;
  }

  .view-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    overflow: hidden;
  }

  .view-tabs button {
    min-width: 0;
    min-height: 52px;
    padding: 0 4px;
    font-size: 12px;
    white-space: nowrap;
  }

  .table-wrap {
    overflow-x: hidden;
    margin-top: 16px;
    border-radius: 11px;
  }

  table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
  }

  th,
  td {
    height: 39px;
    padding: 0 5px;
    white-space: nowrap;
    font-size: 12px;
  }

  .draw-table th:nth-child(1),
  .draw-table td:nth-child(1) {
    width: 21%;
  }

  .draw-table th:nth-child(2),
  .draw-table td:nth-child(2) {
    width: 18%;
  }

  .draw-table th:nth-child(3),
  .draw-table td:nth-child(3) {
    width: 27%;
  }

  .draw-table th:nth-child(4),
  .draw-table td:nth-child(4) {
    width: 18%;
  }

  .draw-table th:nth-child(5),
  .draw-table td:nth-child(5) {
    width: 16%;
  }

  .draw-table th:nth-child(6),
  .draw-table td:nth-child(6),
  .draw-table th:nth-child(7),
  .draw-table td:nth-child(7) {
    display: none;
  }

  .formula {
    font-size: 12px;
  }

  .pill-group {
    justify-content: center;
    gap: 4px;
  }

  .pill {
    min-width: 26px;
    height: 25px;
    padding: 0 7px;
    font-size: 12px;
  }
}

body.layout-pc {
  min-width: 1180px;
}

body.layout-pc .app-header {
  position: sticky;
  top: 0;
  width: 100%;
  height: 54px;
  margin: 0;
}

body.layout-pc .header-inner {
  align-items: center;
  flex-direction: row;
  width: min(100%, 1120px);
  padding: 0 14px;
}

body.layout-pc .header-actions {
  justify-content: flex-end;
}

body.layout-pc .page-shell {
  width: min(calc(100% - 28px), 1120px);
  margin: 14px auto 40px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

body.layout-pc .top-ad-stack {
  margin-bottom: 16px;
}

body.layout-pc .top-ad {
  grid-template-columns: 150px 1fr auto;
  gap: 24px;
  min-height: 116px;
  padding: 12px 26px;
}

body.layout-pc .ad-emblem {
  width: 116px;
  height: 82px;
  font-size: 34px;
}

body.layout-pc .ad-copy strong {
  font-size: clamp(26px, 3.3vw, 38px);
}

body.layout-pc .ad-copy span {
  font-size: clamp(20px, 2.5vw, 30px);
}

body.layout-pc .ad-cta {
  grid-column: auto;
  justify-self: auto;
  min-width: 210px;
  min-height: 44px;
  padding: 0 24px;
  font-size: clamp(22px, 2.8vw, 34px);
}

body.layout-pc .middle-ad {
  grid-template-columns: 120px 1fr auto;
  gap: 18px;
  min-height: 82px;
  padding: 10px 22px;
}

body.layout-pc .middle-ad .ad-emblem {
  width: 86px;
  height: 58px;
  font-size: 28px;
}

body.layout-pc .middle-ad .ad-copy strong {
  font-size: clamp(22px, 2.8vw, 32px);
}

body.layout-pc .middle-ad .ad-copy span {
  font-size: clamp(17px, 2vw, 24px);
}

body.layout-pc .middle-ad .ad-cta {
  min-width: 130px;
  min-height: 36px;
  padding: 0 18px;
  font-size: clamp(18px, 2vw, 24px);
}

body.layout-pc .draw-card {
  padding: 28px 24px 25px;
}

body.layout-pc .draw-header {
  align-items: flex-start;
}

body.layout-pc .latest-line {
  align-items: baseline;
  flex-direction: row;
  gap: 8px;
}

body.layout-pc .draw-main {
  grid-template-columns: 260px 400px;
  margin-top: 53px;
}

body.layout-pc .timer-block,
body.layout-pc .result-shell {
  width: auto;
  justify-self: auto;
}

body.layout-pc .number-block {
  gap: 12px;
}

body.layout-pc .num-ball {
  width: 60px;
  height: 60px;
  font-size: 34px;
}

body.layout-pc .view-tabs {
  grid-template-columns: repeat(8, 1fr);
}

body.layout-mobile {
  min-width: 0;
}

@supports (padding-top: env(safe-area-inset-top)) {
  body.layout-mobile {
    padding-top: env(safe-area-inset-top);
  }

  body.layout-mobile::before {
    content: "";
    position: fixed;
    z-index: 100;
    top: 0;
    left: 0;
    right: 0;
    height: env(safe-area-inset-top);
    background: #000;
  }
}

body.layout-mobile .app-header {
  position: relative;
  top: auto;
  width: min(100%, 430px);
  height: 54px;
  margin: 0 auto;
  border-radius: 0;
  box-shadow: 0 5px 18px rgba(21, 89, 158, 0.2);
}

body.layout-mobile .header-inner {
  align-items: center;
  flex-direction: row;
  justify-content: space-between;
  gap: 8px;
  width: min(100%, 430px);
  height: 100%;
  padding: 0 12px;
}

body.layout-mobile .header-actions {
  justify-content: flex-end;
}

body.layout-mobile .brand {
  min-width: 0;
  font-size: 16px;
}

body.layout-mobile .brand-mark {
  width: 24px;
  height: 24px;
  font-size: 10px;
}

body.layout-mobile .header-button {
  min-height: 32px;
  padding: 0 11px;
  white-space: nowrap;
}

body.layout-mobile .page-shell {
  width: min(100%, 430px);
  margin-top: 0;
  padding: 10px 10px 22px;
  border: 1px solid #d8e7f2;
  border-top: 0;
  background: #fff;
  box-shadow: 0 12px 34px rgba(44, 92, 133, 0.12);
}

body.layout-mobile .top-ad {
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 7px;
  min-height: 42px;
  padding: 5px 8px;
  border-radius: 5px;
}

body.layout-mobile .ad-emblem {
  width: 36px;
  height: 30px;
  border-width: 2px;
  border-radius: 7px;
  font-size: 14px;
}

body.layout-mobile .ad-copy strong {
  font-size: 13px;
  line-height: 1.1;
}

body.layout-mobile .ad-copy span {
  font-size: 11px;
  line-height: 1.1;
}

body.layout-mobile .ad-cta {
  grid-column: 3;
  align-self: center;
  justify-self: end;
  min-width: auto;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 13px;
  font-size: 12px;
}

body.layout-mobile .top-ad-stack {
  gap: 6px;
  margin-bottom: 14px;
}

body.layout-mobile .top-ad-image {
  object-fit: cover;
}

body.layout-mobile .draw-card {
  padding: 22px 14px 24px;
  border-radius: 0 0 12px 12px;
}

body.layout-mobile .draw-header {
  align-items: flex-start;
}

body.layout-mobile .latest-line {
  align-items: flex-start;
  flex-direction: column;
  gap: 4px;
}

body.layout-mobile .draw-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

body.layout-mobile .draw-main {
  grid-template-columns: 1fr;
  margin-top: 28px;
}

body.layout-mobile .timer-block,
body.layout-mobile .result-shell {
  width: min(100%, 400px);
  justify-self: center;
}

body.layout-mobile .timer-block {
  width: clamp(196px, 58%, 236px);
  min-height: 44px;
  gap: 14px;
  padding: 0 14px;
  border-radius: 7px;
}

body.layout-mobile .clock-icon {
  --clock-size: 17px;
  --clock-stroke: 2px;
}

body.layout-mobile .timer-copy {
  gap: 0;
}

body.layout-mobile .timer-label {
  font-size: 10px;
}

body.layout-mobile .timer-value {
  font-size: 12px;
}

body.layout-mobile .timer-value strong {
  font-size: 14px;
}

body.layout-mobile .num-ball {
  width: 46px;
  height: 46px;
  font-size: 28px;
}

body.layout-mobile .number-block {
  gap: 8px;
}

body.layout-mobile .result-shell.has-combo {
  width: 100%;
  padding: 10px 8px;
}

body.layout-mobile .result-shell.has-combo .number-block {
  gap: 6px;
}

body.layout-mobile .result-shell.has-combo .num-ball {
  width: 42px;
  height: 42px;
  font-size: 25px;
}

body.layout-mobile .combo-result {
  gap: 4px;
}

body.layout-mobile .combo-badge {
  width: 34px;
  height: 34px;
  font-size: 15px;
}

body.layout-mobile .result-shell.has-combo .op {
  font-size: 19px;
}

body.layout-mobile .result-shell.has-combo .inline-scratch-canvas {
  inset: 10px 8px;
  width: calc(100% - 16px);
  height: calc(100% - 20px);
}

body.layout-mobile .view-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
}

body.layout-mobile .view-tabs button {
  min-width: 0;
  min-height: 52px;
  padding: 0 4px;
  font-size: 12px;
  white-space: nowrap;
}

body.layout-mobile .table-wrap {
  overflow-x: hidden;
  margin-top: 16px;
  border-radius: 11px;
}

body.layout-mobile table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

body.layout-mobile th,
body.layout-mobile td {
  height: 39px;
  padding: 0 5px;
  white-space: nowrap;
  font-size: 12px;
}

body.layout-mobile .draw-table th:nth-child(1),
body.layout-mobile .draw-table td:nth-child(1) {
  width: 21%;
}

body.layout-mobile .draw-table th:nth-child(2),
body.layout-mobile .draw-table td:nth-child(2) {
  width: 18%;
}

body.layout-mobile .draw-table th:nth-child(3),
body.layout-mobile .draw-table td:nth-child(3) {
  width: 27%;
}

body.layout-mobile .draw-table th:nth-child(4),
body.layout-mobile .draw-table td:nth-child(4) {
  width: 18%;
}

body.layout-mobile .draw-table th:nth-child(5),
body.layout-mobile .draw-table td:nth-child(5) {
  width: 16%;
}

body.layout-mobile .draw-table th:nth-child(6),
body.layout-mobile .draw-table td:nth-child(6),
body.layout-mobile .draw-table th:nth-child(7),
body.layout-mobile .draw-table td:nth-child(7) {
  display: none;
}

body.layout-mobile .formula {
  font-size: 12px;
}

body.layout-mobile .pill-group {
  justify-content: center;
  gap: 4px;
}

body.layout-mobile .pill {
  min-width: 26px;
  height: 25px;
  padding: 0 7px;
  font-size: 12px;
}

body.layout-mobile .shape-pill {
  min-width: 40px;
  height: 24px;
  padding: 0 8px;
  font-size: 12px;
}

body.layout-mobile .result-pager {
  gap: 14px;
  min-height: 58px;
  padding: 8px 0 12px;
}

body.layout-mobile .pager-button {
  min-width: 30px;
  height: 30px;
  border-radius: 8px;
}

body.layout-mobile .visit-stats {
  gap: 3px 8px;
  margin: 12px 0 0;
  padding: 0 2px 10px;
  font-size: 11px;
}

body.layout-mobile .footer-actions {
  gap: 8px;
  margin-top: 12px;
}

body.layout-mobile .footer-action {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}
