:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-strong: #fdfefe;
  --ink: #182026;
  --muted: #63717e;
  --line: #dce3e8;
  --line-strong: #c7d1d8;
  --teal: #0f8b8d;
  --teal-soft: #e2f4f1;
  --indigo: #4d5bd5;
  --indigo-soft: #eceeff;
  --coral: #d9563f;
  --coral-soft: #fff0ec;
  --amber: #b7791f;
  --amber-soft: #fff4d6;
  --green: #2e7d4f;
  --green-soft: #e8f6ed;
  --violet: #7a4db3;
  --violet-soft: #f3ecff;
  --shadow: 0 20px 45px rgba(30, 42, 51, 0.08);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(246, 247, 249, 0.98)),
    repeating-linear-gradient(
      90deg,
      rgba(15, 139, 141, 0.05) 0,
      rgba(15, 139, 141, 0.05) 1px,
      transparent 1px,
      transparent 74px
    );
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

a {
  color: inherit;
}

#app {
  width: min(1500px, calc(100% - 36px));
  margin: 0 auto;
  padding: 18px 0 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 74px;
  padding: 14px 0 18px;
}

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

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.brand-mark svg {
  width: 31px;
  height: 31px;
  fill: none;
  stroke: var(--teal);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-mark circle:nth-of-type(2) {
  stroke: var(--coral);
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.55rem, 1.2rem + 1vw, 2.25rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.brand p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.icon-button,
.source-link {
  display: inline-grid;
  height: 40px;
  min-width: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    background-color 160ms ease;
}

.source-link {
  padding: 0 14px;
  font-weight: 700;
  font-size: 0.85rem;
}

.icon-button:hover,
.source-link:hover {
  border-color: var(--teal);
  background: var(--teal-soft);
  transform: translateY(-1px);
}

.icon-button svg,
.search-box svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.metric-panel {
  min-height: 118px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-panel strong {
  display: block;
  margin: 6px 0 4px;
  font-size: 2.15rem;
  line-height: 1;
  letter-spacing: 0;
}

.metric-panel:nth-child(1) strong {
  color: var(--teal);
}

.metric-panel:nth-child(2) strong {
  color: var(--indigo);
}

.metric-panel:nth-child(3) strong {
  color: var(--coral);
}

.metric-panel:nth-child(4) strong {
  color: var(--green);
}

.metric-panel:nth-child(5) strong {
  color: var(--violet);
}

.metric-label,
.metric-panel span:last-child {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
}

.signal-band {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) minmax(260px, 420px);
  gap: 18px;
  align-items: center;
  min-height: 128px;
  margin-bottom: 14px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.signal-band h2 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.radar-visual {
  position: relative;
  width: 74px;
  height: 74px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background:
    radial-gradient(circle, transparent 29%, var(--line) 30%, transparent 31%),
    radial-gradient(circle, transparent 58%, var(--line) 59%, transparent 60%);
}

.radar-visual::before,
.radar-visual::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 33px;
  height: 1px;
  background: var(--line-strong);
  transform-origin: left center;
}

.radar-visual::before {
  transform: rotate(0deg);
}

.radar-visual::after {
  transform: rotate(90deg);
}

.radar-visual span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--teal);
  transform:
    rotate(calc(var(--i) * 45deg)) translateX(calc(15px + var(--power, 20px)))
    rotate(calc(var(--i) * -45deg));
  opacity: 0.25;
}

.radar-visual span:nth-child(2n) {
  background: var(--coral);
}

.radar-visual span:nth-child(3n) {
  background: var(--indigo);
}

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

.topic-chip,
.skeleton-chip,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  max-width: 100%;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.topic-chip strong {
  margin-left: 6px;
  color: var(--ink);
}

.skeleton-chip {
  width: 92px;
  background: linear-gradient(90deg, #eef2f5, #f8fafb, #eef2f5);
  color: transparent;
}

.stack-map {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  min-height: 74px;
  align-items: stretch;
}

.stack-map span {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 7px 3px;
  border: 1px solid var(--line);
  background: var(--teal-soft);
  color: #185b59;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.12;
  text-align: center;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.stack-map span:nth-child(2) {
  background: var(--indigo-soft);
  color: #39419a;
}

.stack-map span:nth-child(3) {
  background: var(--amber-soft);
  color: #81570e;
}

.stack-map span:nth-child(4) {
  background: var(--violet-soft);
  color: #5d3b88;
}

.stack-map span:nth-child(5) {
  background: var(--coral-soft);
  color: #9c3a2a;
}

.stack-map span:nth-child(6) {
  background: var(--green-soft);
  color: var(--green);
}

.stack-map span:nth-child(7) {
  background: #edf4ff;
  color: #285a9b;
}

.tabs {
  display: flex;
  gap: 6px;
  margin: 0 0 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.tab.is-active {
  border-color: #19343a;
  background: #19343a;
  color: #fff;
}

.workspace {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 330px;
  gap: 12px;
  align-items: start;
}

.feedback-panel {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 18px;
  margin-top: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.feedback-panel h2 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.feedback-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.feedback-form {
  display: grid;
  gap: 10px;
}

.feedback-form textarea {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  color: var(--ink);
  background: #fff;
  font: inherit;
  line-height: 1.5;
}

.feedback-form textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 139, 141, 0.13);
}

.feedback-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.84rem;
}

.feedback-submit {
  min-height: 38px;
  padding: 0 16px;
  border-radius: var(--radius);
  background: #19343a;
  color: #fff;
  cursor: pointer;
  font-weight: 900;
}

.filters,
.content-panel,
.inspector {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.filters {
  position: sticky;
  top: 12px;
  padding: 14px;
}

.filter-group + .filter-group {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.filter-title {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 0.77rem;
  font-weight: 900;
  text-transform: uppercase;
}

.filter-options {
  display: grid;
  gap: 7px;
}

.filter-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
  text-align: left;
}

.filter-button span:last-child {
  color: var(--muted);
  font-size: 0.78rem;
}

.filter-button.is-active {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: #145e5e;
}

.content-panel {
  min-width: 0;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 82px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2 {
  margin: 0;
  font-size: 1.23rem;
}

.panel-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(330px, 42%);
  min-width: 230px;
  height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: #fff;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.content-list {
  display: grid;
  gap: 0;
}

.item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  min-height: 118px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  transition:
    background-color 140ms ease,
    border-color 140ms ease;
}

.item-row:hover,
.item-row.is-selected {
  background: #f8fbfb;
}

.item-row.is-selected {
  border-left: 4px solid var(--teal);
  padding-left: 12px;
}

.item-main {
  min-width: 0;
}

.item-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2f5;
  color: #41505c;
  font-size: 0.74rem;
  font-weight: 900;
  white-space: nowrap;
}

.badge.hot {
  background: var(--coral-soft);
  color: var(--coral);
}

.badge.watch {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge.good {
  background: var(--green-soft);
  color: var(--green);
}

.badge.info {
  background: var(--indigo-soft);
  color: var(--indigo);
}

.badge.quiet {
  background: #f0f3f6;
  color: var(--muted);
}

.item-title {
  margin: 0;
  font-size: 1.04rem;
  line-height: 1.35;
  letter-spacing: 0;
}

.item-title a {
  text-decoration: none;
}

.item-title a:hover {
  color: var(--teal);
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 0.83rem;
}

.item-guide {
  margin: 11px 0 0;
  max-width: 92ch;
  color: #35424c;
  font-size: 0.91rem;
  line-height: 1.55;
}

.item-score {
  display: grid;
  align-content: start;
  justify-items: end;
  gap: 9px;
  min-width: 102px;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: right;
}

.score-ring {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 5px solid var(--teal-soft);
  border-top-color: var(--teal);
  border-right-color: var(--indigo);
  border-radius: 50%;
  color: var(--ink);
  font-weight: 900;
}

.inspector {
  position: sticky;
  top: 12px;
  min-height: 520px;
  max-height: calc(100vh - 24px);
  overflow: auto;
}

.empty-state {
  display: grid;
  min-height: 420px;
  place-items: center;
  align-content: center;
  padding: 28px;
  text-align: center;
}

.empty-icon {
  width: 72px;
  height: 72px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 48%, var(--line) 49%, var(--line) 51%, transparent 52%),
    linear-gradient(0deg, transparent 48%, var(--line) 49%, var(--line) 51%, transparent 52%),
    radial-gradient(circle, var(--teal-soft), #fff 62%);
}

.empty-state h3 {
  margin: 16px 0 6px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.inspector-body {
  padding: 17px;
}

.inspector h3 {
  margin: 0;
  font-size: 1.18rem;
  line-height: 1.35;
}

.inspector-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.inspector-section h4 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.detail-cell {
  min-height: 62px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
}

.detail-cell span {
  display: block;
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 800;
}

.detail-cell strong {
  display: block;
  margin-top: 4px;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.guide-box {
  padding: 12px;
  border-left: 4px solid var(--teal);
  background: var(--teal-soft);
  color: #164f50;
  line-height: 1.55;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  width: 100%;
  margin-top: 14px;
  border-radius: var(--radius);
  background: #19343a;
  color: #fff;
  text-decoration: none;
  font-weight: 900;
}

.briefing {
  display: grid;
  gap: 0;
}

.brief-block {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.brief-block h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

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

.brief-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  color: #35424c;
  line-height: 1.45;
}

.brief-line span:first-child {
  display: inline-grid;
  min-width: 28px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: var(--indigo-soft);
  color: var(--indigo);
  font-size: 0.75rem;
  font-weight: 900;
}

.loading {
  min-height: 180px;
  padding: 18px;
}

.loading-line {
  height: 16px;
  margin-bottom: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #eef2f5, #f8fafb, #eef2f5);
}

.loading-line:nth-child(1) {
  width: 70%;
}

.loading-line:nth-child(2) {
  width: 92%;
}

.loading-line:nth-child(3) {
  width: 48%;
}

.error-box {
  margin: 16px;
  padding: 14px;
  border: 1px solid #f0b6aa;
  border-radius: var(--radius);
  background: var(--coral-soft);
  color: #863225;
}

@media (max-width: 1180px) {
  #app {
    width: min(100% - 24px, 1100px);
  }

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

  .signal-band {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .stack-map {
    grid-column: 1 / -1;
  }

  .workspace {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .feedback-panel {
    grid-template-columns: 1fr;
  }

  .inspector {
    grid-column: 1 / -1;
    position: static;
    min-height: 0;
    max-height: none;
  }

  .empty-state {
    min-height: 210px;
  }
}

@media (max-width: 820px) {
  #app {
    width: min(100% - 18px, 760px);
    padding-top: 8px;
  }

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

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .brand p {
    font-size: 0.85rem;
  }

  .overview-grid,
  .workspace,
  .signal-band {
    grid-template-columns: 1fr;
  }

  .metric-panel {
    min-height: 100px;
  }

  .filters {
    position: static;
  }

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

  .panel-header {
    display: grid;
  }

  .search-box {
    width: 100%;
    min-width: 0;
  }

  .item-row {
    grid-template-columns: 1fr;
  }

  .item-score {
    grid-template-columns: auto auto;
    justify-content: start;
    justify-items: start;
    align-items: center;
    text-align: left;
  }
}

@media (max-width: 520px) {
  .topbar {
    display: grid;
  }

  .top-actions {
    justify-content: flex-end;
  }

  .overview-grid {
    gap: 8px;
  }

  .metric-panel,
  .signal-band,
  .filters,
  .content-panel,
  .inspector {
    border-radius: 6px;
  }

  .filter-options {
    grid-template-columns: 1fr;
  }

  .item-row {
    padding: 14px;
  }

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

  .stack-map {
    grid-template-columns: 1fr;
  }

  .feedback-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .feedback-submit {
    width: 100%;
  }
}
