:root {
  color-scheme: light;
  --ink: #171a1f;
  --muted: #69707d;
  --line: #d9dee7;
  --soft-line: #ecf0f5;
  --paper: #ffffff;
  --canvas: #f5f7fa;
  --charcoal: #20252d;
  --red: #b43a30;
  --red-soft: #fff0ee;
  --gold: #9d7228;
  --green: #24745d;
  --blue: #275f8f;
  --shadow: 0 18px 50px rgba(32, 37, 45, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(180, 58, 48, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(36, 116, 93, 0.055) 1px, transparent 1px),
    var(--canvas);
  background-size: 44px 44px;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 28px;
  overflow: hidden;
  color: #f9fbfd;
  background:
    linear-gradient(135deg, rgba(180, 58, 48, 0.24), transparent 42%),
    linear-gradient(90deg, #20252d, #2e333b 58%, #173f36);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

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

.brand > div:last-child {
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  color: #f6d899;
  border: 1px solid rgba(246, 216, 153, 0.5);
  background: rgba(0, 0, 0, 0.18);
  font-weight: 800;
  letter-spacing: 0;
}

.brand h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.brand p {
  margin: 5px 0 0;
  color: rgba(249, 251, 253, 0.72);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.summary-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.summary-item {
  min-width: 86px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
}

.summary-item strong {
  display: block;
  font-size: 18px;
  line-height: 1.1;
}

.summary-item span {
  display: block;
  margin-top: 3px;
  color: rgba(249, 251, 253, 0.68);
  font-size: 12px;
}

.workspace {
  display: grid;
  grid-template-columns: 320px minmax(300px, 420px) minmax(460px, 1fr);
  gap: 18px;
  padding: 18px;
}

.search-panel,
.results-panel,
.detail-panel {
  min-height: calc(100vh - 126px);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.search-panel {
  padding: 18px;
}

.search-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.search-box span {
  color: var(--red);
  font-size: 20px;
  line-height: 1;
}

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

.tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin: 16px 0 18px;
}

.tab {
  min-height: 34px;
  min-width: 0;
  padding: 0 4px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--paper);
}

.tab.is-active {
  color: #ffffff;
  border-color: var(--red);
  background: var(--red);
}

.quick-panel {
  border-top: 1px solid var(--soft-line);
  padding-top: 14px;
}

.panel-title,
.panel-heading span {
  color: var(--muted);
  font-size: 13px;
}

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

.quick-button {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--soft-line);
  color: var(--ink);
  background: #fafbfc;
  text-align: left;
}

.quick-button span:last-child {
  color: var(--muted);
  font-size: 12px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.panel-heading h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.result-list {
  height: calc(100vh - 185px);
  overflow: auto;
  padding: 10px;
}

.result-button {
  display: block;
  width: 100%;
  padding: 12px;
  border: 1px solid transparent;
  border-bottom-color: var(--soft-line);
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.result-button:hover,
.result-button.is-active {
  border-color: #e3b5ae;
  background: var(--red-soft);
}

.result-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.result-title {
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.type-pill {
  flex: 0 0 auto;
  padding: 3px 7px;
  color: #ffffff;
  background: var(--charcoal);
  font-size: 12px;
}

.type-pill.map {
  background: var(--green);
}

.type-pill.monster {
  background: var(--red);
}

.type-pill.item {
  background: var(--gold);
}

.type-pill.npc {
  background: var(--blue);
}

.result-subtitle {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.detail-panel {
  overflow: auto;
}

.detail-view {
  padding: 20px;
}

.detail-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.detail-kicker {
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.detail-head h2 {
  margin: 4px 0 7px;
  font-size: 28px;
  line-height: 1.15;
}

.detail-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

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

.mini-action {
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--paper);
}

.mini-action:hover {
  border-color: var(--red);
  color: var(--red);
}

.section {
  padding: 18px 0 0;
}

.section h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
  font-size: 17px;
}

.section h3 small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(126px, 1fr));
  gap: 8px;
}

.metric {
  padding: 10px;
  border: 1px solid var(--soft-line);
  background: #fafbfc;
}

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

.metric strong {
  display: block;
  margin-top: 3px;
  font-size: 16px;
}

.table {
  display: grid;
  gap: 8px;
}

.row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(160px, 2fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--soft-line);
  background: #ffffff;
}

.row.compact {
  grid-template-columns: minmax(130px, 1.2fr) minmax(120px, 1fr);
}

.row-title {
  color: var(--ink);
  font-weight: 700;
}

.row-title button,
.inline-link {
  padding: 0;
  border: 0;
  color: var(--red);
  background: transparent;
  font-weight: 700;
  text-align: left;
}

.row-note,
.empty-state {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.tagline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 3px 7px;
  border: 1px solid var(--soft-line);
  color: var(--muted);
  background: #fafbfc;
  font-size: 12px;
}

.route-steps {
  counter-reset: step;
  display: grid;
  gap: 8px;
}

.route-step {
  position: relative;
  padding: 10px 12px 10px 42px;
  border: 1px solid #dce8e3;
  background: #f6fbf8;
}

.route-step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 12px;
  top: 10px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: #ffffff;
  background: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.route-main {
  font-weight: 700;
}

.route-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.empty-state {
  padding: 12px;
  border: 1px dashed var(--line);
  background: #fafbfc;
}

@media (max-width: 1320px) {
  .workspace {
    grid-template-columns: 300px minmax(320px, 1fr);
  }

  .detail-panel {
    grid-column: 1 / -1;
    min-height: 520px;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px;
  }

  .brand {
    width: 100%;
    min-width: 0;
  }

  .brand h1 {
    font-size: 22px;
  }

  .brand p {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .summary-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: flex-start;
    width: 100%;
  }

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

  .summary-item:last-child {
    grid-column: 1 / -1;
  }

  .workspace {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .search-panel,
  .results-panel,
  .detail-panel {
    min-height: auto;
  }

  .search-panel {
    overflow: hidden;
  }

  .tab {
    font-size: 14px;
  }

  .result-list {
    height: auto;
    max-height: 420px;
  }

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

  .detail-actions {
    justify-content: flex-start;
  }

  .row,
  .row.compact {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}
