:root {
  color-scheme: dark;
  --bg: #11130f;
  --panel: #181b16;
  --panel-2: #20251b;
  --text: #f5f3ea;
  --muted: #a9aa9c;
  --line: #343a2d;
  --gold: #f0b90b;
  --green: #47d18c;
  --blue: #7ab7ff;
  --shadow: 0 18px 60px rgba(0, 0, 0, .28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(240, 185, 11, .08), transparent 320px),
    linear-gradient(180deg, rgba(122, 183, 255, .06), transparent 260px),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

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

header {
  position: relative;
  display: grid;
  justify-items: center;
  text-align: center;
  padding: 8px 56px 28px;
  border-bottom: 1px solid var(--line);
}

h1 {
  margin: 0;
  font-size: 38px;
  line-height: 1.15;
  font-weight: 850;
}

.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  max-width: 820px;
  line-height: 1.7;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 15px;
  color: var(--text);
  text-decoration: none;
  font-weight: 750;
  font-size: 14px;
}

.manual-update {
  cursor: pointer;
  background: transparent;
  font: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 0;
  right: 0;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  color: var(--gold);
  text-decoration: none;
  font-weight: 750;
  font-size: 0;
}

.manual-update svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2.2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.manual-update:hover {
  border-color: var(--gold);
  background: rgba(240, 185, 11, .08);
}

.manual-update:disabled {
  cursor: progress;
  opacity: .65;
}

.manual-update[aria-busy="true"] svg {
  animation: spin .9s linear infinite;
}

.nav a.active {
  background: var(--gold);
  border-color: var(--gold);
  color: #17140a;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  margin-top: 22px;
  text-align: left;
}

.summary-card {
  min-height: 102px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .015));
}

.summary-card span,
.summary-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.summary-card strong {
  display: block;
  margin: 8px 0 6px;
  color: var(--text);
  font-size: 26px;
  line-height: 1.1;
  font-weight: 850;
}

.page-section {
  margin-top: 28px;
}

.page-section h2 {
  margin: 0 0 12px;
  font-size: 20px;
  line-height: 1.2;
}

.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
  box-shadow: var(--shadow);
}

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

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

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  background: rgba(255, 255, 255, .035);
  position: sticky;
  top: 0;
}

tbody tr:hover {
  background: rgba(255, 255, 255, .035);
}

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

.featured-row {
  background: rgba(240, 185, 11, .075);
}

.project-cell strong {
  display: block;
  font-size: 15px;
  line-height: 1.25;
  min-width: 150px;
}

.project-cell span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.symbol-link {
  color: var(--gold);
  text-decoration: none;
}

.symbol-link:hover {
  color: #ffd766;
}

.symbol-text {
  color: var(--text);
}

.reward-cell strong {
  display: block;
}

.reward-cell span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  color: var(--muted);
  background: rgba(255, 255, 255, .04);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.status-pill[data-status="active"] {
  color: var(--green);
  border-color: rgba(71, 209, 140, .42);
  background: rgba(71, 209, 140, .08);
}

.status-pill[data-status="upcoming"] {
  color: var(--blue);
  border-color: rgba(122, 183, 255, .42);
  background: rgba(122, 183, 255, .08);
}

.status-pill[data-status="ended"] {
  color: var(--muted);
}

.status-pill[data-status="unknown_time"] {
  color: var(--gold);
  border-color: rgba(240, 185, 11, .4);
  background: rgba(240, 185, 11, .08);
}

.relative-time {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.value-link {
  color: var(--green);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.value-link:hover {
  color: #7ee0aa;
}

.value-muted,
.muted {
  color: var(--muted);
  white-space: nowrap;
}

.table-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
  font-size: 13px;
}

.record-details {
  position: relative;
  width: fit-content;
}

.record-details summary {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
  list-style: none;
  white-space: nowrap;
}

.record-details summary::-webkit-details-marker {
  display: none;
}

.record-details summary:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.details-panel {
  position: absolute;
  z-index: 5;
  right: 0;
  top: 40px;
  width: min(360px, calc(100vw - 40px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #171a14;
  box-shadow: var(--shadow);
}

.details-panel div {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.details-panel div:last-child {
  border-bottom: 0;
}

.details-panel span {
  color: var(--muted);
  font-size: 12px;
}

.details-panel strong {
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
  font-weight: 650;
}

.details-panel a {
  color: var(--gold);
  text-decoration: none;
}

.ai-analysis {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  margin-top: 8px;
  border-top: 1px solid rgba(240, 185, 11, .22);
  padding-top: 12px;
}

.ai-analysis h3 {
  margin: 0;
  color: var(--gold);
  font-size: 13px;
}

.ai-analysis p {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.6;
}

.ai-analysis dl {
  display: grid;
  gap: 0;
  margin: 0;
}

.ai-analysis ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.6;
}

.ai-analysis > strong {
  color: var(--muted);
  font-size: 12px;
}

.ai-analysis small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.ai-analysis[data-state="missing"] {
  color: var(--muted);
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 28px 12px;
}

footer {
  margin-top: 26px;
  color: var(--muted);
  font-size: 12px;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  text-align: center;
}

.site-footer span {
  display: inline-flex;
  align-items: center;
}

.site-footer span + span::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--line);
}

.update-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(760px, 100%);
  margin-top: 14px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, .025);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: left;
}

.update-status:empty {
  display: none;
}

.update-status span {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 2px 7px;
  background: rgba(255, 255, 255, .08);
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
}

.update-status[data-state="ok"] {
  color: var(--green);
  border-color: rgba(71, 209, 140, .35);
  background: rgba(71, 209, 140, .07);
}

.update-status[data-state="warning"] {
  color: var(--gold);
  border-color: rgba(240, 185, 11, .4);
  background: rgba(240, 185, 11, .08);
}

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

@media (prefers-reduced-motion: reduce) {
  .manual-update[aria-busy="true"] svg {
    animation: none;
  }
}

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

  header {
    padding: 48px 0 18px;
  }

  h1 {
    font-size: 30px;
  }

  .subtitle {
    font-size: 13px;
  }

  .update-status {
    display: flex;
    align-items: flex-start;
  }

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

  .summary-card {
    min-height: 92px;
    padding: 12px;
  }

  .summary-card strong {
    font-size: 22px;
  }

  .table-wrap {
    border: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  table {
    border-collapse: separate;
    border-spacing: 0 10px;
  }

  thead {
    display: none;
  }

  tbody tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
    overflow: hidden;
  }

  tbody tr:hover {
    background: var(--panel);
  }

  td {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    border-bottom: 1px solid var(--line);
    padding: 11px 12px;
    font-size: 13px;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }

  .project-cell,
  .reward-cell {
    align-items: start;
  }

  .project-cell strong {
    min-width: 0;
  }

  .table-link {
    width: fit-content;
  }

  .record-details {
    width: 100%;
  }

  .record-details summary {
    width: fit-content;
  }

  .details-panel {
    position: static;
    width: 100%;
    margin-top: 8px;
    box-shadow: none;
  }

  .site-footer {
    display: grid;
    justify-items: center;
    gap: 6px;
  }

  .site-footer span + span::before {
    display: none;
  }
}

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

  td {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 10px;
  }
}
