:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #182024;
  --muted: #68747b;
  --line: #d8e0e4;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: #e3f4f1;
  --amber: #b7791f;
  --amber-soft: #fff5db;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --shadow: 0 16px 40px rgba(24, 32, 36, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 18px 0 8px;
}

.kicker {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(30px, 4.5vw, 48px);
  line-height: 1.05;
  font-weight: 800;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
}

.source-pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
}

.query-panel,
.result-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.query-panel {
  padding: 20px;
}

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

.ghost-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
}

.ghost-button:hover {
  color: var(--ink);
  border-color: #b6c3c9;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  min-width: 0;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field-wide {
  grid-column: 1 / -1;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

input,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  color: var(--ink);
  outline: none;
  padding: 12px 13px;
  font-size: 16px;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
  background: #fff;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  margin-top: 16px;
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.primary-button:hover:not(:disabled) {
  background: var(--accent-strong);
}

.primary-button:disabled {
  cursor: not-allowed;
  background: #c8d3d7;
  color: #f8fbfb;
}

.result-panel {
  margin-top: 18px;
  min-height: 220px;
  padding: 20px;
}

.empty-state {
  display: grid;
  min-height: 180px;
  place-items: center;
  gap: 10px;
  color: var(--muted);
  text-align: center;
}

.empty-mark {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 900;
}

.result-list {
  display: grid;
  gap: 14px;
}

.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.result-card.primary {
  border-color: rgba(15, 118, 110, 0.45);
  background: linear-gradient(180deg, #f7fffd 0%, #ffffff 64%);
}

.result-card.caution {
  border-color: rgba(183, 121, 31, 0.4);
  background: var(--amber-soft);
}

.result-card.miss {
  border-color: rgba(180, 35, 24, 0.35);
  background: var(--danger-soft);
}

.result-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  margin-bottom: 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
}

.result-card.caution .result-label {
  background: #ffe9b5;
  color: var(--amber);
}

.result-card.miss .result-label {
  background: #ffd9d4;
  color: var(--danger);
}

.result-title {
  font-size: clamp(20px, 3vw, 28px);
  line-height: 1.22;
  font-weight: 850;
}

.result-title strong {
  color: var(--accent);
}

.result-card.caution .result-title strong {
  color: var(--amber);
}

.result-card.miss .result-title strong {
  color: var(--danger);
}

.reason-list {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.reason-list li {
  position: relative;
  padding-left: 16px;
  color: #435057;
  line-height: 1.55;
}

.reason-list li::before {
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.result-card.caution .reason-list li::before {
  background: var(--amber);
}

.result-card.miss .reason-list li::before {
  background: var(--danger);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.meta-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfcfc;
  color: var(--muted);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
}

.secondary-title {
  margin: 6px 0 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

@media (max-width: 760px) {
  .app-shell {
    width: min(680px, calc(100% - 24px));
    padding: 18px 0;
  }

  .topbar {
    display: grid;
    align-items: start;
    padding-top: 6px;
  }

  .source-pill {
    justify-self: start;
  }

  .query-panel,
  .result-panel {
    padding: 16px;
  }

  .field-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .primary-button {
    min-height: 50px;
  }
}
