:root {
  --ink: #172126;
  --muted: #617178;
  --panel: #ffffff;
  --paper: #f5f8f6;
  --line: #d8e4df;
  --front: #c93a30;
  --back: #156aa8;
  --green: #2b7a57;
  --gold: #b77a1a;
  --shadow: 0 18px 46px rgba(20, 40, 42, .11);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(23, 33, 38, .05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(23, 33, 38, .04) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
}

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

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

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 800;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 4px;
  background: var(--ink);
  border-radius: 8px;
}

.brand-mark span {
  border-radius: 50%;
  background: var(--front);
}

.brand-mark span:nth-child(3n) { background: var(--back); }
.brand-mark span:nth-child(5) { background: var(--gold); }

button {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

button:disabled {
  opacity: .62;
  cursor: default;
}

button:focus-visible {
  outline: 3px solid rgba(21, 106, 168, .25);
  outline-offset: 2px;
}

.copy-button {
  min-height: 34px;
  padding: 0 12px;
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
}

.copy-button:hover {
  border-color: var(--ink);
}

.summary-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, .9fr);
  gap: 22px;
  align-items: stretch;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 50px);
  line-height: 1.05;
  letter-spacing: 0;
}

.lead {
  max-width: 680px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  align-content: end;
}

.metrics div {
  min-height: 108px;
  padding: 14px;
  border-top: 4px solid var(--ink);
  background: #fafdff;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metrics strong {
  display: block;
  margin-top: 12px;
  font-size: 22px;
}

section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.recommend-section {
  margin-top: 20px;
  padding: 18px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

h2 {
  margin: 0;
  font-size: 19px;
}

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

.ticket {
  min-height: 128px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.ticket-index {
  color: var(--muted);
  font: 700 13px Consolas, "Segoe UI Mono", monospace;
}

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

.ball {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font: 800 14px Consolas, "Segoe UI Mono", monospace;
}

.front { background: var(--front); }
.back { background: var(--back); }

.lower-grid {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 20px;
  margin-top: 20px;
}

.lower-grid section {
  padding: 18px;
}

.recent-list {
  display: grid;
  gap: 10px;
}

.draw-row {
  display: grid;
  grid-template-columns: 86px 108px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 52px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.draw-row time,
.draw-row strong {
  color: var(--muted);
  font-size: 13px;
}

.freq-group + .freq-group {
  margin-top: 18px;
}

h3 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
}

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

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: #fff;
  font-size: 13px;
}

.chip strong {
  color: var(--green);
  font-family: Consolas, "Segoe UI Mono", monospace;
}

.empty {
  color: var(--muted);
  line-height: 1.7;
}

.error-box {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(201, 58, 48, .35);
  border-radius: 8px;
  background: rgba(201, 58, 48, .08);
  color: #8d211b;
}

.disclaimer {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

@media (max-width: 980px) {
  .summary-panel,
  .lower-grid,
  .tickets {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 640px) {
  .shell {
    width: min(100% - 22px, 1180px);
    padding-top: 12px;
  }

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

  button {
    width: 100%;
  }

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

  .summary-panel {
    padding: 18px;
  }

  .metrics,
  .draw-row {
    grid-template-columns: 1fr;
  }

  .ticket {
    min-height: auto;
  }
}
