:root {
  --ink: #142033;
  --ink-soft: #3a4658;
  --paper: #eef2f6;
  --paper-2: #e3e9f0;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --crimson: #d32f2f;
  --crimson-deep: #9f1d1d;
  --azure: #1e6fd9;
  --azure-deep: #0f4fa8;
  --teal: #0f766e;
  --teal-soft: #14b8a6;
  --line: rgba(20, 32, 51, 0.1);
  --shadow-soft: 0 1px 0 rgba(20, 32, 51, 0.04);
  --radius: 18px;
  --font-display: "Noto Serif SC", "Songti SC", serif;
  --font-body: "DM Sans", "Noto Sans SC", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(900px 520px at 8% -10%, rgba(211, 47, 47, 0.12), transparent 55%),
    radial-gradient(800px 480px at 100% 0%, rgba(15, 118, 110, 0.14), transparent 50%),
    radial-gradient(700px 420px at 70% 100%, rgba(30, 111, 217, 0.1), transparent 55%),
    linear-gradient(180deg, #f7f9fb 0%, var(--paper) 40%, var(--paper-2) 100%);
  background-attachment: fixed;
  line-height: 1.55;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(20, 32, 51, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 32, 51, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.45), transparent 70%);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  border: 0;
  background: none;
  cursor: pointer;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 96px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-mark {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.brand-mark span {
  color: var(--teal);
}

.brand-sub {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.lottery-switch {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.lottery-switch a {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.lottery-switch a.active {
  background: var(--ink);
  color: #fff;
}

.lottery-switch a:hover:not(.active) {
  color: var(--ink);
}

.hero {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  padding: clamp(28px, 5vw, 48px);
  min-height: 280px;
  color: #f7fafc;
  background:
    linear-gradient(135deg, rgba(20, 32, 51, 0.92), rgba(15, 79, 168, 0.78) 55%, rgba(15, 118, 110, 0.75)),
    url("data:image/svg+xml,%3Csvg width='160' height='160' viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='0.08'%3E%3Ccircle cx='80' cy='80' r='54'/%3E%3Ccircle cx='80' cy='80' r='28'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover, 120px 120px;
  box-shadow: var(--shadow-soft);
  animation: heroIn 0.7s ease both;
}

.hero::after {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  right: -60px;
  bottom: -90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(211, 47, 47, 0.35), transparent 70%);
  pointer-events: none;
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 28px;
  grid-template-columns: 1.2fr 0.8fr;
  align-items: end;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(247, 250, 252, 0.72);
}

.hero-kicker::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal-soft);
  box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.2);
}

.hero h1 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.02em;
}

.hero-lead {
  margin: 0;
  max-width: 36ch;
  font-size: 16px;
  color: rgba(247, 250, 252, 0.8);
}

.hero-meta {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
}

.hero-meta-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.hero-meta-item span:first-child {
  color: rgba(247, 250, 252, 0.65);
}

.hero-meta-item strong {
  font-family: var(--font-mono);
  font-weight: 600;
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 28px 0 18px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.tab-btn {
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink-soft);
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.panel {
  display: none;
  animation: rise 0.45s ease both;
}

.panel.active {
  display: block;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 8px 0 18px;
}

.section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
}

.section-head p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.banner {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(211, 47, 47, 0.08);
  border: 1px solid rgba(211, 47, 47, 0.18);
  color: var(--crimson-deep);
  font-size: 14px;
}

.banner.info {
  background: rgba(15, 118, 110, 0.08);
  border-color: rgba(15, 118, 110, 0.18);
  color: var(--teal);
}

.strategy-list {
  display: grid;
  gap: 14px;
}

.strategy-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.strategy-row:hover {
  transform: translateY(-2px);
  border-color: rgba(15, 118, 110, 0.35);
}

.strategy-label {
  display: grid;
  gap: 4px;
}

.strategy-label strong {
  font-size: 15px;
}

.strategy-label span {
  font-size: 12px;
  color: var(--ink-soft);
}

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

.ball {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.12);
}

.ball.red {
  background: linear-gradient(180deg, #ef5350, var(--crimson));
}

.ball.blue {
  background: linear-gradient(180deg, #42a5f5, var(--azure));
}

.ball.hit {
  outline: 2px solid #f4c430;
  outline-offset: 2px;
}

.ball-sep {
  width: 1px;
  height: 28px;
  margin: 0 4px;
  background: var(--line);
}

.hit-chip {
  margin-left: auto;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.1);
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.desc {
  grid-column: 1 / -1;
  margin: 0;
  padding-top: 4px;
  color: var(--ink-soft);
  font-size: 13px;
}

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

.chart-block {
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface-solid);
  border: 1px solid var(--line);
}

.chart-block h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.chart-wrap {
  position: relative;
  height: 240px;
}

.history-search {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 10px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-solid);
}

.history-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.history-field span {
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 600;
}

.history-field input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 14px;
  outline: none;
}

.history-field input:focus {
  border-color: rgba(15, 79, 168, 0.45);
}

.history-search-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-primary,
.btn-ghost {
  appearance: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--navy, #0f4fa8);
  color: #fff;
  border-color: var(--navy, #0f4fa8);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line);
}

.history-search-meta {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--ink-soft);
}

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

.history-table-wrap {
  overflow: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-solid);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th,
td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: var(--ink-soft);
  font-weight: 600;
}

td.mono {
  font-family: var(--font-mono);
}

.archive-list {
  display: grid;
  gap: 12px;
  margin-bottom: 24px;
}

.archive-item {
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}

.archive-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 14px;
}

.archive-top strong {
  font-family: var(--font-mono);
}

.footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 13px;
}

.footer strong {
  color: var(--ink);
}

.loading {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: var(--paper);
}

.loading-inner {
  text-align: center;
}

.spinner {
  width: 42px;
  height: 42px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 3px solid rgba(15, 118, 110, 0.15);
  border-top-color: var(--teal);
  animation: spin 0.8s linear infinite;
}

.hidden {
  display: none !important;
}

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

@keyframes heroIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 860px) {
  .hero-grid,
  .strategy-row,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .hit-chip {
    margin-left: 0;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1120px);
    padding-bottom: 72px;
  }

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

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