:root {
  color-scheme: dark;
  --bg: #080a0f;
  --panel: rgba(18, 23, 32, 0.92);
  --line: rgba(232, 214, 166, 0.18);
  --text: #f4ecd9;
  --muted: #b5bfce;
  --gold: #f5c45f;
  --green: #60d394;
  --blue: #79b8ff;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 16% 0%, rgba(245, 196, 95, 0.16), transparent 23rem),
    radial-gradient(circle at 84% 10%, rgba(121, 184, 255, 0.16), transparent 24rem),
    linear-gradient(145deg, #06070a 0%, #12151d 48%, #071016 100%);
  color: var(--text);
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  background-image:
    linear-gradient(rgba(255,255,255,0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.022) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

a {
  color: #ffdf8f;
  font-weight: 850;
  text-decoration-color: rgba(245, 196, 95, 0.55);
}

.rules-shell {
  position: relative;
  z-index: 1;
  width: min(1060px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 42px;
}

.rules-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.rules-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 950;
}

.rules-mark {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(245, 196, 95, 0.34);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(245,196,95,0.2), rgba(121,184,255,0.12));
  color: #ffe7a7;
}

.rules-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rules-links a,
.rules-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 8px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.055);
  color: #fff7e6;
  text-decoration: none;
  font-size: 13px;
  font-weight: 850;
}

.rules-button-primary {
  border-color: rgba(245, 196, 95, 0.42);
  background: linear-gradient(180deg, rgba(245, 196, 95, 0.24), rgba(143, 63, 45, 0.22));
}

.rules-hero,
.rules-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 54px rgba(0,0,0,0.28);
}

.rules-hero {
  padding: clamp(22px, 4vw, 38px);
  margin-bottom: 14px;
}

.rules-kicker {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.05;
}

h1 {
  max-width: 760px;
  font-size: clamp(34px, 7vw, 64px);
}

.rules-lede {
  max-width: 760px;
  margin: 14px 0 0;
  color: #d3dfec;
  font-size: 17px;
  line-height: 1.55;
}

.rules-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.rules-stat,
.rules-card,
.rules-mini {
  min-width: 0;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  background: rgba(255,255,255,0.045);
}

.rules-stat { padding: 12px; }

.rules-stat span,
.rules-mini-title {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.rules-stat strong {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
  color: #fff7e2;
  font-size: 18px;
  line-height: 1.15;
}

.rules-section {
  padding: clamp(18px, 3vw, 26px);
  margin-top: 14px;
}

.rules-section h2 { font-size: clamp(22px, 4vw, 34px); }

.rules-section h3 {
  color: #fff3d3;
  font-size: 16px;
}

.rules-section p,
.rules-section li {
  color: #cbd6e3;
  font-size: 15px;
  line-height: 1.55;
}

.rules-section p { margin: 10px 0 0; }

.rules-section ul,
.rules-section ol {
  margin: 12px 0 0;
  padding-left: 20px;
}

.rules-section li + li { margin-top: 7px; }

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

.rules-card { padding: 14px; }
.rules-card p:first-child { margin-top: 0; }

.rules-callout {
  margin-top: 14px;
  border: 1px solid rgba(245, 196, 95, 0.22);
  border-radius: 8px;
  padding: 12px 13px;
  background: rgba(245, 196, 95, 0.08);
  color: #ffe9b5;
  font-weight: 850;
}

.rules-callout-green {
  border-color: rgba(96, 211, 148, 0.28);
  background: rgba(96, 211, 148, 0.08);
  color: #d8ffe6;
}

.rules-formula {
  margin-top: 12px;
  border: 1px solid rgba(121, 184, 255, 0.22);
  border-radius: 8px;
  padding: 12px;
  background: rgba(121, 184, 255, 0.08);
  color: #e3f2ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: nowrap;
}

.rules-table-wrap {
  margin-top: 12px;
  overflow-x: auto;
}

.rules-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255,255,255,0.04);
}

.rules-table th,
.rules-table td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  color: #d7e2ef;
  font-size: 14px;
  text-align: left;
  white-space: nowrap;
}

.rules-table th {
  color: #fff2cc;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

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

.rules-steps {
  counter-reset: rules-step;
  list-style: none;
  padding-left: 0;
}

.rules-steps li {
  counter-increment: rules-step;
  position: relative;
  min-height: 40px;
  padding-left: 48px;
}

.rules-steps li::before {
  content: counter(rules-step);
  position: absolute;
  left: 0;
  top: 2px;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid rgba(245, 196, 95, 0.28);
  border-radius: 8px;
  background: rgba(245, 196, 95, 0.1);
  color: var(--gold);
  font-weight: 950;
}

.rules-mini-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.rules-mini { padding: 10px; }

.rules-mini strong {
  display: block;
  margin-top: 4px;
  color: #fff7df;
  font-size: 15px;
}

.rules-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 760px) {
  .rules-shell {
    width: min(100% - 20px, 1060px);
    padding-top: 12px;
  }

  .rules-nav { align-items: stretch; }
  .rules-links { width: 100%; }

  .rules-links a,
  .rules-button {
    flex: 1 1 auto;
    min-width: 0;
    padding-inline: 9px;
    font-size: 12px;
  }

  .rules-summary,
  .rules-grid,
  .rules-mini-grid {
    grid-template-columns: 1fr;
  }

  .rules-hero,
  .rules-section {
    padding: 16px;
  }

  .rules-formula { font-size: 12px; }
}
