:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --ink: #172033;
  --muted: #667085;
  --line: #d8dee9;
  --panel: #ffffff;
  --panel-2: #eef6ff;
  --orange: #f0642f;
  --red: #cf2f2f;
  --blue: #2563eb;
  --teal: #07847f;
  --green: #168a4a;
  --shadow: 0 18px 40px rgba(17, 24, 39, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 42%, #edf4f2 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 72px;
  padding: 12px max(18px, env(safe-area-inset-left)) 12px max(18px, env(safe-area-inset-right));
  border-bottom: 1px solid rgba(216, 222, 233, 0.86);
  background: rgba(248, 251, 255, 0.92);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 8px 20px rgba(207, 47, 47, 0.18);
}

.brand span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.brand strong {
  font-size: 17px;
  line-height: 1.1;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
}

main {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 18px 16px 40px;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 154px;
  gap: 14px;
  align-items: stretch;
  padding: 18px;
  border: 1px solid rgba(216, 222, 233, 0.9);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.intro-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 32px;
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 21px;
  line-height: 1.2;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 17px;
  line-height: 1.25;
}

.subtitle {
  max-width: 520px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.signal-card {
  display: grid;
  align-content: center;
  gap: 7px;
  min-height: 132px;
  padding: 16px;
  border-radius: 8px;
  background: #111827;
  color: #ffffff;
}

.signal-card strong {
  font-size: 19px;
  line-height: 1.2;
}

.signal-card small,
.signal-label {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

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

.quick-link {
  display: grid;
  gap: 6px;
  min-height: 78px;
  padding: 13px;
  border: 1px solid rgba(216, 222, 233, 0.92);
  border-radius: 8px;
  background: var(--panel);
}

.quick-link.primary {
  border-color: rgba(240, 100, 47, 0.42);
  background: #fff2eb;
}

.quick-link span {
  font-size: 15px;
  font-weight: 800;
}

.quick-link small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.panel,
.market-strip {
  margin-top: 14px;
  border: 1px solid rgba(216, 222, 233, 0.94);
  border-radius: 8px;
  background: var(--panel);
}

.panel {
  padding: 16px;
}

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

.ghost-button,
.icon-button,
.entry-action {
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.ghost-button {
  min-height: 38px;
  padding: 0 12px;
  background: #eaf0f8;
  color: #243148;
  white-space: nowrap;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  background: #eaf0f8;
  color: #1f2937;
}

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

.entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.entry.featured {
  border-color: rgba(37, 99, 235, 0.34);
  background: var(--panel-2);
}

.entry-kicker {
  margin: 0 0 5px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.entry p:not(.entry-kicker) {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.entry-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 38px;
  padding: 0 13px;
  background: #172033;
  color: #ffffff;
}

.market-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
}

.market-strip div {
  display: grid;
  gap: 6px;
  min-height: 74px;
  padding: 14px;
  border-right: 1px solid rgba(216, 222, 233, 0.94);
}

.market-strip div:last-child {
  border-right: 0;
}

.market-strip span,
.metric-grid span {
  color: var(--muted);
  font-size: 12px;
}

.market-strip strong,
.metric-grid strong {
  font-size: 18px;
  line-height: 1.2;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.metric-grid article {
  display: grid;
  gap: 8px;
  min-height: 96px;
  padding: 14px;
  border-radius: 8px;
  background: #f7f9fc;
}

.metric-grid small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

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

.tag-cloud span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(7, 132, 127, 0.24);
  border-radius: 8px;
  background: #ecf8f6;
  color: #075f5b;
  font-size: 13px;
  font-weight: 800;
}

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

.review-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f7f9fc;
}

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

.review-list strong {
  text-align: right;
  font-size: 14px;
}

.disclaimer {
  margin: 16px 4px 0;
  color: #7a4f16;
  font-size: 12px;
  line-height: 1.6;
}

.settings-dialog {
  width: min(460px, calc(100% - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(17, 24, 39, 0.28);
}

.settings-dialog::backdrop {
  background: rgba(17, 24, 39, 0.48);
}

.settings-dialog form {
  padding: 16px;
}

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

.dialog-head h2 {
  font-size: 19px;
}

.settings-dialog p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.settings-dialog code {
  color: var(--red);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.settings-dialog dl {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
}

.settings-dialog dl div {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  background: #f7f9fc;
}

.settings-dialog dt {
  color: var(--blue);
  font-weight: 800;
}

.settings-dialog dd {
  margin: 0;
  color: var(--muted);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 20;
  width: min(360px, calc(100% - 32px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #111827;
  color: #ffffff;
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  transform: translate(-50%, 18px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

@media (max-width: 700px) {
  .topbar {
    min-height: 66px;
  }

  .brand img {
    width: 44px;
    height: 44px;
  }

  main {
    padding: 14px 12px 34px;
  }

  .intro {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .signal-card {
    min-height: 104px;
  }

  h1 {
    font-size: 28px;
  }

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

  .metric-grid,
  .market-strip {
    grid-template-columns: 1fr;
  }

  .market-strip div {
    border-right: 0;
    border-bottom: 1px solid rgba(216, 222, 233, 0.94);
  }

  .market-strip div:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 380px) {
  .ghost-button {
    min-width: 38px;
    padding: 0 9px;
    font-size: 12px;
  }

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

  .entry-action {
    width: 100%;
  }
}
