:root {
  color-scheme: light;
  --ink: #102033;
  --muted: #637083;
  --line: #dbe4ef;
  --soft: #f4f7fb;
  --panel: #ffffff;
  --brand: #123c70;
  --brand-2: #1c77c3;
  --aqua: #2db8cf;
  --warn: #b85b10;
  --warn-bg: #fff5e8;
  --ok: #14765a;
  --ok-bg: #eaf8f3;
  --shadow: 0 14px 38px rgba(16, 32, 51, 0.12);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #edf4fb 0%, #f8fafc 36%, #ffffff 100%);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

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

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

.app-shell {
  min-height: 100vh;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: rgba(248, 250, 252, 0.92);
  border-bottom: 1px solid rgba(219, 228, 239, 0.78);
  backdrop-filter: blur(16px);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 16px;
  line-height: 1.2;
}

.brand small {
  max-width: 190px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ghost-button,
.text-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--brand);
  font-weight: 700;
}

.ghost-button {
  padding: 0 14px;
}

.text-button {
  padding: 0 10px;
  font-size: 13px;
}

.section {
  margin: 14px auto 0;
  padding: 0 16px;
  max-width: 1120px;
}

.hero {
  position: relative;
  display: grid;
  gap: 16px;
  overflow: hidden;
  padding-top: 16px;
}

.hero-copy {
  position: relative;
  z-index: 2;
  min-width: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 560px;
  margin-bottom: 16px;
  font-size: 30px;
  line-height: 1.16;
  overflow-wrap: anywhere;
}

h2 {
  margin-bottom: 0;
  font-size: 21px;
  line-height: 1.25;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

.hero-art {
  width: 100%;
  min-height: 158px;
  max-height: 250px;
  object-fit: cover;
  object-position: center;
  border: 1px solid rgba(219, 228, 239, 0.8);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.search-box {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 28px rgba(18, 60, 112, 0.1);
}

.search-box input {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  outline: 0;
  background: #f5f8fc;
  color: var(--ink);
  padding: 0 12px;
}

.search-box button,
.primary-full {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

.suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 8px;
  right: 8px;
  z-index: 10;
  display: none;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.suggestions.show {
  display: block;
}

.suggestions button {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.quick-tags,
.history-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0 2px;
  scrollbar-width: none;
}

.quick-tags::-webkit-scrollbar,
.history-strip::-webkit-scrollbar {
  display: none;
}

.chip,
.history-chip {
  flex: 0 0 auto;
  min-height: 36px;
  border: 1px solid #cdd9e8;
  border-radius: 8px;
  background: #fff;
  color: var(--brand);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
}

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

.result-panel,
.tools,
.knowledge {
  padding-top: 16px;
}

.result-summary,
.compare-output,
.disclaimer {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  padding: 14px;
  line-height: 1.6;
}

.result-list,
.industry-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.result-card,
.industry-card,
.class-card,
.tool-card,
.knowledge article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 6px 18px rgba(16, 32, 51, 0.05);
}

.result-card,
.industry-card {
  padding: 14px;
}

.result-card header,
.industry-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.class-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  height: 30px;
  border-radius: 8px;
  background: #e9f3ff;
  color: var(--brand);
  font-weight: 900;
}

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

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag {
  border-radius: 8px;
  background: var(--soft);
  color: #435167;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 700;
}

.risk {
  margin-top: 10px;
  border-radius: 8px;
  background: var(--warn-bg);
  color: var(--warn);
  padding: 10px;
  font-size: 13px;
  line-height: 1.45;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  min-width: 154px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.segmented button {
  min-height: 34px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: var(--brand);
  color: #fff;
}

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

.class-card {
  position: relative;
  min-height: 104px;
  padding: 10px;
  text-align: left;
}

.class-card input {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.class-card button {
  display: block;
  width: 100%;
  min-height: 78px;
  padding: 0 18px 0 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.class-card strong {
  display: block;
  color: var(--brand);
  font-size: 17px;
}

.class-card span {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.industry-card .plan-row {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.plan-box {
  border-radius: 8px;
  background: #f6f9fc;
  padding: 10px;
}

.plan-box strong {
  display: block;
  margin-bottom: 6px;
  color: var(--brand);
  font-size: 13px;
}

.tool-grid {
  display: grid;
  gap: 10px;
}

.tool-card {
  min-height: 92px;
  padding: 14px;
  text-align: left;
}

.tool-card span {
  display: inline-flex;
  margin-bottom: 8px;
  border-radius: 8px;
  background: var(--ok-bg);
  color: var(--ok);
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 800;
}

.tool-card strong {
  display: block;
  line-height: 1.45;
}

.compare-output {
  display: none;
  margin-top: 10px;
}

.compare-output.show {
  display: block;
}

.knowledge {
  display: grid;
  gap: 10px;
}

.knowledge .section-head {
  margin-bottom: 2px;
}

.knowledge article {
  padding: 14px;
}

.knowledge p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.65;
}

.disclaimer {
  margin: 18px 16px 0;
  font-size: 12px;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
}

.bottom-nav a {
  display: grid;
  place-items: center;
  min-height: 46px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.bottom-nav a.active {
  background: #e8f2fd;
  color: var(--brand);
}

.sheet {
  width: min(520px, calc(100% - 22px));
  max-height: 82vh;
  overflow: auto;
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.sheet::backdrop {
  background: rgba(9, 20, 33, 0.46);
}

.sheet-close {
  position: sticky;
  top: 0;
  float: right;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.sheet h2 {
  padding-right: 42px;
}

.sheet label {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  color: var(--muted);
  font-weight: 700;
}

.sheet textarea {
  min-height: 108px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.detail-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.detail-list div {
  border-radius: 8px;
  background: var(--soft);
  padding: 10px;
  line-height: 1.55;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: calc(78px + env(safe-area-inset-bottom));
  left: 16px;
  z-index: 40;
  display: none;
  border-radius: 8px;
  background: rgba(16, 32, 51, 0.94);
  color: #fff;
  padding: 12px 14px;
  text-align: center;
}

.toast.show {
  display: block;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (min-width: 700px) {
  .app-shell {
    padding-bottom: 20px;
  }

  .topbar {
    padding-left: 28px;
    padding-right: 28px;
  }

  .hero {
    grid-template-columns: minmax(0, 0.95fr) minmax(320px, 0.85fr);
    align-items: center;
    padding-top: 26px;
  }

  h1 {
    font-size: 44px;
  }

  .section {
    padding-left: 28px;
    padding-right: 28px;
  }

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

  .result-list,
  .industry-list,
  .tool-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bottom-nav {
    right: 28px;
    bottom: 18px;
    left: 50%;
    max-width: 480px;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
  }

  .disclaimer {
    max-width: 1064px;
    margin-right: auto;
    margin-left: auto;
  }
}

@media (max-width: 360px) {
  h1 {
    font-size: 26px;
  }

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

  .search-box {
    grid-template-columns: 1fr;
  }
}
