:root {
  color-scheme: light;
  --blue: #304979;
  --blue-hover: #263d69;
  --label: #61749a;
  --muted: #b8bdc4;
  --page: #f5f6f6;
  --outside: #f1f2f4;
  --white: #ffffff;
  --border: #dfe2e6;
  --danger: #b34343;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--outside); }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--blue);
  background: var(--outside);
}

body:not(.results-view) {
  height: 100dvh;
  overflow: hidden;
}

button, input { font: inherit; }

.app-frame {
  width: min(100%, 980px);
  min-height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--page);
  border: 1px solid var(--border);
}

.banner {
  width: 100%;
  height: clamp(118px, 26dvh, 298px);
  background: #fbfcfd url("./assets/query-banner.png") center center / cover no-repeat;
}

.content {
  position: relative;
  min-height: calc(100dvh - clamp(118px, 26dvh, 298px));
  padding: 0 clamp(42px, 8vw, 92px) max(32px, env(safe-area-inset-bottom));
  background: var(--page);
  border-radius: 34px 34px 0 0;
}

.query-panel {
  display: flex;
  min-height: inherit;
  height: calc(100dvh - clamp(118px, 26dvh, 298px));
  padding-top: clamp(28px, 6dvh, 66px);
  flex-direction: column;
}

h1 {
  margin: 0 0 clamp(28px, 7dvh, 82px);
  color: var(--blue);
  font-size: clamp(40px, 5.1vw, 52px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .08em;
}

form {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}

.field-card {
  position: relative;
  display: flex;
  min-height: clamp(104px, 15dvh, 154px);
  padding: 34px 35px 29px;
  flex-direction: column;
  justify-content: center;
  background: var(--white);
  border: 1px solid transparent;
  border-radius: 28px;
  transition: border-color .2s, box-shadow .2s;
}

.field-card:focus-within {
  border-color: #aebbd2;
  box-shadow: 0 10px 32px rgba(48, 73, 121, .08);
}

label {
  display: block;
  margin-bottom: 14px;
  color: var(--label);
  font-size: 26px;
  font-weight: 650;
  line-height: 1.3;
}

input {
  width: 100%;
  padding: 0;
  color: #2e3f61;
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 28px;
  line-height: 1.35;
}

input::placeholder { color: var(--muted); opacity: 1; }
.field-card:has(input[aria-invalid="true"]) { border-color: #deb6b6; }

.field-error {
  min-height: 25px;
  margin: 6px 10px 0;
  color: var(--danger);
  font-size: 14px;
}

.form-spacer { min-height: 100px; flex: 1; }

.privacy-note {
  margin: 0 0 16px;
  color: #929aa8;
  font-size: 13px;
  text-align: center;
}

#submit-button {
  display: flex;
  width: 100%;
  min-height: clamp(58px, 9dvh, 98px);
  margin-bottom: clamp(12px, 3dvh, 32px);
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: white;
  background: var(--blue);
  border: 0;
  border-radius: 22px;
  cursor: pointer;
  font-size: clamp(18px, 2.6dvh, 27px);
  transition: background .2s, transform .15s, opacity .2s;
}

#submit-button svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2.2;
}

#submit-button:hover { background: var(--blue-hover); }
#submit-button:active { transform: translateY(1px); }
#submit-button:disabled { cursor: wait; opacity: .7; }

.results { padding: 60px 0 40px; }
.results-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 30px; }
h2 { margin: 0; color: var(--blue); font-size: 34px; letter-spacing: .06em; }
.result-count { padding: 7px 13px; color: var(--blue); background: #e7ebf2; border-radius: 999px; font-size: 14px; }
.result-list { display: grid; gap: 18px; }
.result-item { padding: 28px 30px; background: var(--white); border-radius: 22px; box-shadow: 0 8px 24px rgba(48, 73, 121, .045); }
.result-index { margin-bottom: 18px; color: #9aa5b9; font-size: 13px; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.result-label { display: block; margin-bottom: 8px; color: var(--label); font-size: 15px; }
.result-value { margin: 0; color: #273a61; overflow-wrap: anywhere; font-size: 19px; font-weight: 650; line-height: 1.6; }
.empty-state { padding: 55px 20px; color: #929aa8; background: white; border-radius: 22px; text-align: center; line-height: 1.8; }
.empty-state strong { display: block; margin-bottom: 5px; color: var(--blue); font-size: 21px; }
.secondary-button { width: 100%; min-height: 68px; margin-top: 26px; color: var(--blue); background: transparent; border: 1px solid var(--blue); border-radius: 16px; cursor: pointer; font-size: 18px; }
.status { min-height: 26px; padding-bottom: 20px; color: var(--danger); text-align: center; }

body.results-view .banner { display: none; }
body.results-view { min-height: 100dvh; overflow: auto; }
body.results-view .app-frame { height: auto; min-height: 100dvh; overflow: visible; }
body.results-view .content { min-height: 100vh; padding-top: 0; }
body.results-view .results { min-height: 100vh; padding-top: 72px; }

@media (min-width: 1020px) {
  .app-frame { margin: 24px auto; min-height: calc(100dvh - 48px); height: calc(100dvh - 48px); border-radius: 28px; box-shadow: 0 18px 55px rgba(38, 49, 69, .08); }
  .banner { height: clamp(160px, 25dvh, 298px); }
  .content { min-height: calc(100dvh - 48px - clamp(160px, 25dvh, 298px)); padding-bottom: 20px; }
  .query-panel { height: calc(100dvh - 48px - clamp(160px, 25dvh, 298px)); padding-top: clamp(24px, 4dvh, 44px); }
  h1 { margin-bottom: clamp(18px, 3.5dvh, 40px); }
  .field-card { min-height: clamp(90px, 11dvh, 126px); padding: 22px 30px; border-radius: 24px; }
  label { margin-bottom: 8px; font-size: clamp(20px, 2.2dvh, 24px); }
  input { font-size: clamp(21px, 2.5dvh, 26px); }
  .field-error { min-height: 20px; margin-top: 4px; }
  .form-spacer { min-height: 24px; }
  .privacy-note { margin-bottom: 10px; }
  #submit-button { min-height: clamp(58px, 7.5dvh, 76px); margin-bottom: 0; border-radius: 18px; }
}

@media (max-width: 620px) {
  .banner { height: clamp(118px, 31vw, 190px); }
  .content { min-height: calc(100dvh - clamp(118px, 31vw, 190px)); padding: 0 7.8vw max(16px, env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; }
  .query-panel { height: calc(100dvh - clamp(118px, 31vw, 190px)); padding-top: min(9vw, 8dvh); }
  h1 { margin-bottom: 11vw; font-size: clamp(28px, 7.4vw, 42px); }
  form { min-height: 0; }
  .field-card { min-height: 18.5vw; padding: 4.5vw; border-radius: 5vw; }
  label { margin-bottom: 1.4vw; font-size: clamp(16px, 3.7vw, 23px); }
  input { font-size: clamp(18px, 4.3vw, 26px); }
  .field-error { min-height: 5vw; margin-top: 1vw; font-size: 12px; }
  .form-spacer { min-height: min(14vw, 7dvh); }
  .privacy-note { margin-bottom: 10px; font-size: 11px; }
  #submit-button { min-height: max(54px, 12vw); margin-bottom: max(14px, 4.5vw); border-radius: 3.5vw; font-size: clamp(18px, 4.2vw, 25px); }
  #submit-button svg { width: 6vw; height: 6vw; }
  .results { padding-top: 38px; }
  h2 { font-size: 28px; }
  .result-grid { grid-template-columns: 1fr; gap: 18px; }
  body.results-view .content { min-height: 100dvh; }
  body.results-view .results { min-height: 100dvh; padding-top: 11vw; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
