:root {
  --bg: #15130f;
  --panel: #211d17;
  --panel-2: #2b261d;
  --line: #4b4031;
  --text: #f2eadb;
  --muted: #b7a98e;
  --gold: #d2a84d;
  --gold-2: #f1d17b;
  --ink: #0f0d0a;
  --red: #b85b4a;
  --green: #74a892;
  --blue: #6ea2b8;
  --road: #c48b63;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(210, 168, 77, 0.13), transparent 32%),
    linear-gradient(135deg, #18140e 0%, #252116 46%, #11100c 100%);
  font-family: "Microsoft YaHei", "Noto Serif SC", "Songti SC", serif;
  letter-spacing: 0;
}

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

button {
  border: 1px solid rgba(210, 168, 77, 0.55);
  background: linear-gradient(180deg, #d8b45f, #9d7228);
  color: #19130a;
  height: 38px;
  padding: 0 14px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.08);
}

button.secondary,
button.ghost-btn {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-color: var(--line);
}

button.danger {
  background: rgba(184, 91, 74, 0.2);
  color: #ffd6ce;
  border-color: rgba(184, 91, 74, 0.55);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #15120e;
  color: var(--text);
  border-radius: 6px;
  padding: 10px 11px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(210, 168, 77, 0.16);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

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

.sidebar {
  padding: 22px;
  background: rgba(17, 14, 10, 0.82);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 10px;
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
}

.brand p,
.eyebrow {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.seal {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(210, 168, 77, 0.8);
  background: #3b2418;
  color: var(--gold-2);
  font-size: 27px;
  font-weight: 800;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.05);
}

.panel {
  background: rgba(33, 29, 23, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  display: grid;
  gap: 13px;
  box-shadow: var(--shadow);
}

.panel.compact {
  margin-top: auto;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 800;
}

.page-nav {
  display: grid;
  gap: 8px;
}

.page-nav a,
.feature-card,
.direction-chip {
  color: inherit;
  text-decoration: none;
}

.page-nav a {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
}

.page-nav a.active,
.page-nav a:hover {
  color: var(--ink);
  background: var(--gold);
  border-color: var(--gold);
  font-weight: 800;
}

.pill {
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 4px 9px;
  color: var(--gold-2);
  font-size: 12px;
  background: rgba(210, 168, 77, 0.08);
}

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

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

.workspace {
  padding: 24px;
  min-width: 0;
}

.tabs {
  display: inline-flex;
  background: #14110d;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 18px;
}

.tab {
  min-width: 86px;
  background: transparent;
  color: var(--muted);
  border: 0;
  height: 34px;
}

.tab.active {
  background: var(--gold);
  color: var(--ink);
}

.tab-page {
  display: none;
}

.tab-page.active {
  display: block;
}

.topline,
.library-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.topline h2,
.library-head h2 {
  margin: 0;
  font-size: 34px;
}

.score-card {
  width: 154px;
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(33, 29, 23, 0.82);
  text-align: right;
}

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

.score-card strong {
  display: block;
  font-size: 30px;
  color: var(--gold-2);
}

.analysis-grid {
  display: grid;
  grid-template-columns: minmax(360px, 46vw) minmax(320px, 1fr);
  gap: 18px;
  align-items: start;
}

.overview-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}

.feature-card {
  min-height: 190px;
  border: 1px solid rgba(210, 168, 77, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(140deg, rgba(210, 168, 77, 0.14), rgba(255, 255, 255, 0.03)),
    rgba(33, 29, 23, 0.82);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: end;
  box-shadow: var(--shadow);
}

.feature-card.wide {
  grid-row: span 2;
  min-height: 396px;
  background:
    radial-gradient(circle at 30% 18%, rgba(241, 209, 123, 0.22), transparent 34%),
    conic-gradient(from 45deg, rgba(210, 168, 77, 0.17), transparent, rgba(116, 168, 146, 0.14), transparent),
    rgba(33, 29, 23, 0.86);
}

.feature-card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
}

.feature-card h3 {
  margin: 8px 0;
  font-size: 25px;
}

.feature-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.card-kicker {
  color: var(--gold-2);
  font-size: 12px;
  font-weight: 800;
}

.dashboard-panel {
  margin-top: 18px;
}

.direction-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.direction-chip {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(15, 13, 10, 0.35);
  display: grid;
  gap: 4px;
}

.direction-chip strong {
  color: var(--gold-2);
  font-size: 20px;
}

.direction-chip span,
.direction-chip em {
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
}

.direction-chip.filled {
  border-color: rgba(116, 168, 146, 0.62);
  background: rgba(116, 168, 146, 0.1);
}

.compass-wrap,
.result-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(33, 29, 23, 0.78);
  padding: 18px;
  box-shadow: var(--shadow);
}

.compass {
  position: relative;
  aspect-ratio: 1;
  width: min(100%, 660px);
  margin: 0 auto;
  border-radius: 50%;
  background:
    radial-gradient(circle, transparent 0 21%, rgba(210, 168, 77, 0.16) 21% 22%, transparent 22%),
    repeating-conic-gradient(from -22.5deg, rgba(255, 255, 255, 0.05) 0 2deg, transparent 2deg 45deg),
    radial-gradient(circle, #2d271f 0, #15120e 72%);
  border: 1px solid rgba(210, 168, 77, 0.5);
  overflow: hidden;
}

.sector {
  position: absolute;
  width: 31%;
  height: 31%;
  display: grid;
  place-items: center;
  border: 1px solid rgba(210, 168, 77, 0.24);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.sector:hover,
.sector.active {
  transform: translateY(-2px);
  border-color: var(--gold);
  background: rgba(210, 168, 77, 0.16);
}

.sector .dir {
  display: block;
  font-weight: 900;
  font-size: 19px;
}

.sector .state {
  margin-top: 7px;
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.sector.north { top: 3%; left: 34.5%; }
.sector.south { bottom: 3%; left: 34.5%; }
.sector.east { right: 3%; top: 34.5%; }
.sector.west { left: 3%; top: 34.5%; }
.sector.ne { right: 11%; top: 11%; }
.sector.nw { left: 11%; top: 11%; }
.sector.se { right: 11%; bottom: 11%; }
.sector.sw { left: 11%; bottom: 11%; }

.center-mark {
  position: absolute;
  inset: 38%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(210, 168, 77, 0.7);
  color: var(--gold-2);
  background: rgba(15, 13, 10, 0.9);
  font-weight: 900;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 6px;
}

.sand { background: var(--green); }
.water { background: var(--blue); }
.road { background: var(--road); }
.empty { background: #6b6253; }

.sector[data-family="沙"] { box-shadow: inset 0 -5px 0 var(--green); }
.sector[data-family="水"] { box-shadow: inset 0 -5px 0 var(--blue); }
.sector[data-family="路"] { box-shadow: inset 0 -5px 0 var(--road); }

.findings {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.finding,
.library-item,
.report-section {
  border: 1px solid rgba(210, 168, 77, 0.18);
  border-radius: 8px;
  background: rgba(15, 13, 10, 0.38);
  padding: 14px;
}

.finding h3,
.library-item h3,
.report-section h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.meta,
.quote,
.advice {
  color: var(--muted);
  line-height: 1.65;
  font-size: 14px;
}

.quote {
  color: #e7d7b6;
}

.risk {
  display: inline-block;
  border-radius: 99px;
  padding: 3px 8px;
  margin-left: 8px;
  font-size: 12px;
  border: 1px solid var(--line);
}

.risk.good { color: #b9e8d3; border-color: rgba(116, 168, 146, 0.6); }
.risk.bad { color: #ffc5bb; border-color: rgba(184, 91, 74, 0.6); }
.risk.mixed { color: #f1d17b; border-color: rgba(210, 168, 77, 0.6); }

.library-head input {
  max-width: 390px;
}

.stats-line {
  color: var(--muted);
  margin-bottom: 14px;
}

.library-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
}

.report {
  max-width: 980px;
  display: grid;
  gap: 14px;
}

.report h2 {
  font-size: 31px;
  margin: 0;
}

.empty-state {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 22px;
  text-align: center;
}

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

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

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

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

  .feature-card.wide {
    min-height: 260px;
  }
}

@media (max-width: 620px) {
  .workspace,
  .sidebar {
    padding: 14px;
  }

  .topline,
  .library-head {
    align-items: stretch;
    flex-direction: column;
  }

  .topline h2,
  .library-head h2 {
    font-size: 26px;
  }

  .score-card {
    width: 100%;
    text-align: left;
  }

  .sector .dir {
    font-size: 15px;
  }

  .sector .state {
    font-size: 11px;
  }
}

@media print {
  body {
    background: #fff;
    color: #111;
  }

  .sidebar,
  .tabs,
  .analysis-grid,
  .library-head,
  #analysisTab,
  #libraryTab {
    display: none !important;
  }

  .shell,
  .workspace,
  .tab-page.active {
    display: block;
    padding: 0;
  }

  #reportTab {
    display: block !important;
  }

  .report-section {
    border-color: #bbb;
    color: #111;
  }
}
