:root {
  color-scheme: dark;
  --bg: #07111d;
  --bg-2: #101f33;
  --panel: rgba(8, 17, 29, 0.78);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #e7edf6;
  --muted: #8e9caf;
  --accent: #ffb347;
  --accent-2: #73d6ff;
  --good: #24d28d;
  --bad: #ff6b6b;
  --flat: #9cb1d1;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1000px 520px at 12% -5%, rgba(255, 179, 71, 0.22), transparent 60%),
    radial-gradient(880px 460px at 90% 0%, rgba(115, 214, 255, 0.18), transparent 60%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.8), transparent 92%);
  pointer-events: none;
}

.bg-orb {
  position: fixed;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  opacity: 0.28;
  pointer-events: none;
  filter: blur(10px);
}

.orb-1 {
  left: -120px;
  top: -120px;
  background: radial-gradient(circle, rgba(255, 179, 71, 0.62), transparent 68%);
}

.orb-2 {
  right: -120px;
  bottom: -160px;
  background: radial-gradient(circle, rgba(115, 214, 255, 0.44), transparent 68%);
}

.wrap {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: calc(44px + env(safe-area-inset-top)) 0 calc(36px + env(safe-area-inset-bottom));
}

.top-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 179, 71, 0.18);
  background: linear-gradient(180deg, rgba(255, 179, 71, 0.12), rgba(255, 255, 255, 0.04));
  color: #ffd79d;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

.top-notice.is-busy {
  opacity: 0.76;
}

.notice-text {
  flex: 1 1 auto;
  max-width: 100%;
}

.hero {
  display: grid;
  gap: 8px;
  margin-bottom: 22px;
}

.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 6px 12px;
  border: 1px solid rgba(255, 179, 71, 0.25);
  border-radius: 999px;
  color: var(--accent);
  background: rgba(255, 179, 71, 0.1);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  line-height: 1;
  letter-spacing: 0.06em;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}

.status {
  color: var(--accent);
}

.status[data-kind="ok"] {
  color: var(--good);
}

.status[data-kind="error"] {
  color: var(--bad);
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.panel {
  padding: 20px;
  border-radius: 24px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel-actions {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.panel-head h2 {
  margin: 0 0 6px;
  font-size: 24px;
}

.panel-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 11px 18px;
  color: #1b1306;
  background: linear-gradient(135deg, #ffb347, #ffd483);
  box-shadow: 0 14px 30px rgba(255, 179, 71, 0.24);
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(255, 179, 71, 0.28);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: 2px solid rgba(255, 212, 131, 0.85);
  outline-offset: 2px;
}

.btn:disabled {
  cursor: wait;
  opacity: 0.7;
  transform: none;
  box-shadow: 0 10px 24px rgba(255, 179, 71, 0.18);
}

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

.current-card {
  min-height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.current-card.accent {
  background: linear-gradient(180deg, rgba(255, 179, 71, 0.18), rgba(255, 179, 71, 0.07));
  border-color: rgba(255, 179, 71, 0.22);
}

.current-card.accent-alt {
  background: linear-gradient(180deg, rgba(115, 214, 255, 0.18), rgba(115, 214, 255, 0.07));
  border-color: rgba(115, 214, 255, 0.22);
}

.current-card.accent-soft {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  border-color: rgba(255, 255, 255, 0.1);
}

.current-card.wide {
  grid-column: span 2;
}

.card-label {
  color: var(--muted);
  font-size: 12px;
}

.current-card strong {
  font-size: 24px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.stats-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-weight: 700;
  color: var(--text);
}

.history-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
}

.history-meta strong {
  font-size: 15px;
}

.history-meta span {
  color: var(--muted);
  font-size: 13px;
}

.divider {
  color: var(--muted);
}

.sim-panel {
  margin-top: 20px;
}

.info-panel {
  margin-top: 20px;
}

.toolbar {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.toolbar-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.segmented {
  display: inline-flex;
  padding: 4px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.segmented-compact .segmented-btn {
  min-width: 72px;
}

.segmented-btn {
  border: 0;
  min-width: 88px;
  padding: 9px 14px;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.segmented-btn:hover {
  color: var(--text);
}

.segmented-btn:focus-visible {
  outline: 2px solid rgba(255, 212, 131, 0.85);
  outline-offset: 2px;
}

.segmented-btn[aria-selected="true"] {
  color: #08111d;
  background: linear-gradient(135deg, rgba(255, 179, 71, 0.96), rgba(255, 212, 131, 0.92));
  box-shadow: 0 10px 24px rgba(255, 179, 71, 0.18);
}

.sim-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-top: 18px;
}

.sim-card {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.sim-card-p1 {
  background: linear-gradient(180deg, rgba(255, 179, 71, 0.14), rgba(255, 179, 71, 0.05));
  border-color: rgba(255, 179, 71, 0.18);
}

.sim-card-p2 {
  background: linear-gradient(180deg, rgba(115, 214, 255, 0.14), rgba(115, 214, 255, 0.05));
  border-color: rgba(115, 214, 255, 0.18);
}

.sim-card-dual {
  background: linear-gradient(180deg, rgba(36, 210, 141, 0.14), rgba(36, 210, 141, 0.05));
  border-color: rgba(36, 210, 141, 0.16);
}

.sim-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sim-signal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.signal-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.signal-pill.up {
  background: rgba(36, 210, 141, 0.14);
  color: var(--good);
}

.signal-pill.down {
  background: rgba(255, 107, 107, 0.16);
  color: var(--bad);
}

.signal-pill.flat {
  background: rgba(156, 177, 209, 0.12);
  color: var(--flat);
}

.sim-balance {
  display: block;
  margin-top: 14px;
  font-size: 30px;
  line-height: 1.1;
}

.sim-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.sim-table-wrap {
  margin-top: 14px;
}

.sim-table-wrap table {
  min-width: 1280px;
}

.table-wrap {
  margin-top: 18px;
  overflow-x: auto;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.history-pager {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

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

.info-card {
  min-height: 156px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.info-card strong {
  font-size: 22px;
  line-height: 1.2;
}

.info-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.history-toolbar {
  grid-template-columns: auto auto;
  align-items: center;
  justify-items: end;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  background: rgba(6, 14, 24, 0.76);
}

th,
td {
  padding: 14px 12px;
  text-align: left;
  font-size: 14px;
  white-space: nowrap;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: rgba(13, 22, 34, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

tbody tr.active-row {
  background: linear-gradient(90deg, rgba(255, 179, 71, 0.11), rgba(115, 214, 255, 0.08));
}

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

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

.pair {
  font-weight: 700;
  letter-spacing: 0.03em;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.tag.up {
  background: rgba(36, 210, 141, 0.14);
  color: var(--good);
}

.tag.down {
  background: rgba(255, 107, 107, 0.16);
  color: var(--bad);
}

.tag.flat {
  background: rgba(156, 177, 209, 0.12);
  color: var(--flat);
}

.tag.empty {
  background: transparent;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  color: var(--muted);
}

.prediction-cell {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.result-badge.good {
  background: rgba(36, 210, 141, 0.14);
  color: var(--good);
}

.result-badge.bad {
  background: rgba(255, 107, 107, 0.18);
  color: var(--bad);
}

.exit-text {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.value-up {
  color: var(--good);
}

.value-down {
  color: var(--bad);
}

.open-close {
  font-variant-numeric: tabular-nums;
}

.time-cell {
  color: #d6dfec;
}

.footnote {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.site-footer {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  text-align: center;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 16px;
  font-size: 13px;
}

.footer-nav a {
  color: var(--accent-2);
  text-decoration: none;
}

.footer-nav a:hover {
  text-decoration: underline;
}

.owner-stats-grid {
  margin-top: 18px;
}

.owner-logout-btn {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: none;
}

.owner-logout-btn:hover {
  box-shadow: none;
}


@media (max-width: 920px) {
  .current-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .current-card.wide {
    grid-column: span 2;
  }
}

@media (max-width: 680px) {
  .wrap {
    width: min(100% - 20px, 1120px);
    padding-top: calc(28px + env(safe-area-inset-top));
  }

  .top-notice {
    margin-bottom: 14px;
    padding: 9px 12px;
    font-size: 12px;
    letter-spacing: 0.02em;
  }

  .panel {
    padding: 14px;
    border-radius: 18px;
  }

  .panel-head {
    flex-direction: column;
  }

  .panel-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

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

  .history-meta {
    align-items: flex-start;
  }

  .history-pager {
    justify-content: stretch;
  }

  .toolbar {
    width: 100%;
    justify-items: stretch;
  }

  .history-toolbar {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .segmented {
    width: 100%;
  }

  .segmented-btn {
    flex: 1 1 0;
  }

  .btn {
    width: 100%;
  }

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

  .current-card.wide {
    grid-column: span 1;
  }

  .current-card strong {
    font-size: 20px;
  }

  .stats-strip {
    padding: 12px 14px;
    font-size: 13px;
  }

  .sim-card {
    padding: 16px;
  }

  .sim-stats {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .divider {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bg-orb {
    display: none;
  }

  .btn {
    transition: none;
  }
}
