:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #18202a;
  --muted: #667487;
  --line: #d9e1ec;
  --primary: #1540d1;
  --primary-strong: #102ea0;
  --accent: #dfe8ff;
  --success: #0b7a45;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(21, 32, 56, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
  color: var(--text);
}

a {
  color: inherit;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  border-bottom: 1px solid rgba(217, 225, 236, 0.7);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
}

.brand {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.nav {
  display: flex;
  gap: 18px;
}

.nav a {
  text-decoration: none;
  color: var(--muted);
}

.main-content {
  padding: 48px 0 72px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.9fr);
  gap: 28px;
  align-items: start;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  color: var(--primary);
  font-weight: 700;
}

h1 {
  font-size: clamp(2.4rem, 5vw, 4.5rem);
  line-height: 0.98;
  margin: 10px 0 20px;
  letter-spacing: -0.05em;
  max-width: 12ch;
}

.lede {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
  max-width: 64ch;
}

.actions {
  display: flex;
  gap: 14px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 18px;
  border-radius: 12px;
  text-decoration: none;
  border: 1px solid transparent;
  font-weight: 700;
}

.button.primary {
  background: var(--primary);
  color: #fff;
}

.button.primary:hover {
  background: var(--primary-strong);
}

.button.secondary {
  background: var(--panel);
  border-color: var(--line);
}

.card {
  background: var(--panel);
  border: 1px solid rgba(217, 225, 236, 0.95);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(217, 225, 236, 0.95);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.narrow {
  max-width: 540px;
}

.medium {
  max-width: 680px;
}

.wide {
  width: 100%;
}

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

.stack-form label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

.stack-form input,
.stack-form select,
.search-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  background: #fff;
  font: inherit;
}

.flash {
  padding: 14px 16px;
  border-radius: 16px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
}

.flash.success {
  background: #eaf8f0;
  color: var(--success);
  border-color: #b7e3c8;
}

.flash.error {
  background: #fff2f1;
  color: var(--danger);
  border-color: #f3c7c2;
}

.inline-form {
  display: inline;
}

.nav-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  padding: 0;
}

.muted,
.subtle,
.meta-line {
  color: var(--muted);
}

.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
}

.balance-card {
  background: linear-gradient(150deg, #0e1b4f 0%, #1540d1 100%);
  color: #fff;
}

.compact-balance-card {
  max-width: 640px;
}

.balance-card .eyebrow,
.balance-card .meta-line {
  color: rgba(255, 255, 255, 0.8);
}

.balance-value {
  max-width: none;
  margin: 12px 0 20px;
}

.toolbar,
.search-form,
.stats-row {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.search-form {
  min-width: min(100%, 360px);
}

.lottery-grid {
  align-items: start;
}

.lottery-hero {
  background:
    radial-gradient(circle at top left, rgba(255, 209, 102, 0.32), transparent 35%),
    linear-gradient(140deg, #10214d 0%, #1540d1 52%, #1b8f6a 100%);
  color: #fff;
}

.lottery-title {
  max-width: 12ch;
  margin-bottom: 14px;
}

.lottery-hero .eyebrow,
.lottery-hero .lede,
.lottery-hero .meta-line {
  color: rgba(255, 255, 255, 0.82);
}

.lottery-stat-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.lottery-stat {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.lottery-stat span {
  display: block;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.72);
}

.lottery-stat strong {
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.lottery-banner {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.14);
}

.lottery-note {
  color: var(--muted);
  margin-bottom: 0;
  margin-top: 14px;
}

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

.stats-row {
  align-items: stretch;
}

.stat-box {
  flex: 1 1 180px;
}

.stat-box span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.stat-box strong,
.stats-grid dd {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

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

.stats-grid dt {
  color: var(--muted);
  margin-bottom: 6px;
}

.stats-grid dd {
  margin: 0;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.transaction-table {
  min-width: 980px;
}

.transaction-table th,
.transaction-table td {
  white-space: nowrap;
}

.transaction-table th:last-child,
.transaction-table td:last-child {
  white-space: normal;
  min-width: 220px;
}

.transaction-table th:first-child,
.transaction-table td:first-child {
  min-width: 140px;
}

.transaction-table th:nth-child(4),
.transaction-table td:nth-child(4),
.transaction-table th:nth-child(5),
.transaction-table td:nth-child(5) {
  min-width: 130px;
}

.transaction-table th:nth-child(6),
.transaction-table td:nth-child(6) {
  min-width: 120px;
  text-align: right;
}

.table th,
.table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-size: 0.9rem;
}

.leaderboard-note {
  color: var(--muted);
  font-weight: 600;
}

.rank-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--primary-strong);
  font-weight: 800;
}

.leaderboard-table td:last-child {
  font-weight: 700;
}

.stack-section {
  display: grid;
  gap: 24px;
}

.button.danger {
  background: var(--danger);
  color: #fff;
}

.stats-card h2 {
  margin-top: 0;
  margin-bottom: 14px;
  font-size: 1.1rem;
}

.clean-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.clean-list li {
  color: var(--muted);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.clean-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

@media (max-width: 800px) {
  .hero {
    grid-template-columns: 1fr;
  }

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

  .header-row {
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    padding: 12px 0;
  }

  .nav {
    flex-wrap: wrap;
    justify-content: center;
  }

  .lottery-stat-row,
  .lottery-stats-grid {
    grid-template-columns: 1fr;
  }
}
