:root {
  color-scheme: light;
  --bg: #f1f4f7;
  --panel: #ffffff;
  --soft: #f8fafc;
  --text: #1f2933;
  --muted: #667085;
  --line: #d6dee8;
  --blue: #0f6b99;
  --green: #1f7a59;
  --red: #bc4b51;
  --gold: #9a6a16;
  --purple: #7353ba;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: 360px minmax(780px, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  border-right: 1px solid var(--line);
  background: #fbfcfe;
}

header h1 {
  margin: 0 0 6px;
  font-size: 30px;
}

header p,
footer {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
}

.controls {
  display: grid;
  gap: 12px;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: white;
}

.field input,
.field select {
  height: 38px;
  padding: 0 10px;
}

.field textarea {
  min-height: 84px;
  padding: 10px;
  resize: vertical;
  line-height: 1.55;
}

.switch {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
}

.switch input {
  width: 18px;
  height: 18px;
}

button {
  min-height: 42px;
  border: 1px solid var(--blue);
  border-radius: 7px;
  background: var(--blue);
  color: white;
  font-weight: 800;
  cursor: pointer;
}

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

.workspace {
  padding: 22px;
  overflow: auto;
  background: white;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.topbar p,
.topbar span {
  margin: 0;
  color: var(--muted);
}

.topbar h2 {
  margin: 5px 0;
  font-size: 34px;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  justify-content: flex-end;
  gap: 8px;
}

.badges span,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef6fb;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

.pillars {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.pillar {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 14px;
}

.pillar .label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.pillar .gz {
  margin: 8px 0;
  font-size: 34px;
  font-weight: 850;
}

.pillar .detail {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

h3 {
  margin: 22px 0 10px;
  font-size: 18px;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 16px;
}

.elements,
.luck,
.analysis,
.sources,
.summary {
  display: grid;
  gap: 10px;
}

.bar {
  display: grid;
  grid-template-columns: 54px 1fr 58px;
  gap: 10px;
  align-items: center;
}

.track {
  height: 12px;
  border-radius: 999px;
  background: #edf1f5;
  overflow: hidden;
}

.fill {
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.card,
.analysis article,
.source-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 12px;
}

.card strong,
.analysis strong,
.source-card strong {
  display: block;
  margin-bottom: 5px;
}

.card p,
.analysis p,
.source-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.analysis .tag {
  margin-top: 10px;
  margin-right: 6px;
}

.knowledge-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.knowledge-item {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.knowledge-item strong {
  margin-bottom: 4px;
  font-size: 14px;
}

.knowledge-item em {
  display: block;
  margin-bottom: 4px;
  color: var(--blue);
  font-style: normal;
  font-weight: 800;
}

.knowledge-item a,
.source-links a {
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.ai-panel {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 12px;
}

.ai-result {
  min-height: 120px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 12px;
  color: var(--muted);
  line-height: 1.7;
  white-space: pre-wrap;
}

.ai-result.ready {
  color: var(--text);
}

.ai-result.error {
  color: var(--red);
  border-color: #e8b6b9;
  background: #fff6f6;
}

.luck-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(90px, 1fr));
  gap: 8px;
}

.luck-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.luck-item.active {
  border-color: #9bc5da;
  background: #eef6fb;
}

.luck-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.luck-item strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

footer {
  margin-top: auto;
  line-height: 1.6;
}

@media (max-width: 1050px) {
  .shell,
  .split {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

@media (max-width: 640px) {
  .pillars,
  .grid2,
  .luck-grid {
    grid-template-columns: 1fr;
  }
}
