:root {
  --paper: #f4f6f3;
  --surface: #ffffff;
  --ink: #202724;
  --muted: #69736e;
  --line: #dbe1dd;
  --jade: #176b57;
  --jade-soft: #e7f2ee;
  --cinnabar: #982c25;
  --cinnabar-soft: #f8ecea;
  --gold: #a87929;
  --gold-soft: #f7f0df;
  --blue: #315e81;
  --blue-soft: #eaf1f6;
  --shadow: 0 4px 16px rgba(32, 39, 36, 0.07);
  --font-ui: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  color-scheme: light;
  font-family: var(--font-ui);
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
}

body {
  min-width: 320px;
  font-size: 15px;
  line-height: 1.55;
  font-family: var(--font-ui);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

h1,
h2,
h3,
strong {
  font-family: var(--font-ui);
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--jade);
  outline-offset: 2px;
}

.activation-gate {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: calc(28px + env(safe-area-inset-top)) 24px calc(28px + env(safe-area-inset-bottom));
  background: var(--paper);
}

.activation-inner {
  width: min(100%, 440px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 34px;
}

.brand-mark,
.mini-mark {
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--ink);
  border: 3px solid var(--jade);
  font-family: var(--font-ui);
  font-weight: 700;
}

.brand-mark {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  box-shadow: inset 0 0 0 4px var(--ink), inset 0 0 0 5px var(--gold);
  font-size: 25px;
}

.brand-lockup h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.25;
}

.brand-lockup p {
  margin: 5px 0 0;
  color: var(--cinnabar);
  font-weight: 700;
}

.activation-block {
  margin-bottom: 22px;
}

.activation-block > label,
.field-label-row label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.field-label-row label {
  margin: 0;
}

.device-id {
  display: block;
  min-height: 50px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 6px;
  background: var(--surface);
  font-family: Consolas, monospace;
  font-size: 17px;
  font-weight: 700;
  word-break: break-all;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid #cbd3ce;
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
}

textarea {
  min-height: 104px;
  padding: 13px 14px;
  resize: none;
  font-family: Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
}

.form-message {
  min-height: 22px;
  margin: 6px 0 8px;
  color: var(--cinnabar);
  font-size: 13px;
}

.form-message.success {
  color: var(--jade);
}

.primary-button,
.text-button,
.icon-button,
.status-button,
.bottom-nav button,
.segmented-control button,
.mini-segmented button,
.settings-row {
  border: 0;
  cursor: pointer;
}

.primary-button {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 16px;
  border-radius: 6px;
  background: var(--jade);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(23, 107, 87, 0.2);
}

.primary-button:active {
  transform: translateY(1px);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.64;
  transform: none;
}

.primary-button svg,
.text-button svg,
.icon-button svg,
.status-button svg,
.privacy-note svg {
  width: 18px;
  height: 18px;
}

.icon-button {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: transparent;
}

.icon-button:active {
  background: #e8ece9;
}

.privacy-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 30px;
  color: var(--muted);
  font-size: 12px;
}

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

.topbar {
  position: fixed;
  z-index: 20;
  inset: 0 0 auto;
  height: calc(68px + env(safe-area-inset-top));
  padding: calc(12px + env(safe-area-inset-top)) 18px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(219, 225, 221, 0.9);
  background: rgba(244, 246, 243, 0.97);
}

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

.mini-mark {
  width: 35px;
  height: 35px;
  flex: 0 0 35px;
  border-width: 2px;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px var(--gold);
  font-size: 17px;
}

.topbar h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.2;
}

.topbar p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.status-button {
  min-width: 0;
  max-width: 150px;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 0 0 12px;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.status-button.trusted {
  color: var(--jade);
}

.status-button > span {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.status-button strong,
.status-button small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-button strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.status-button small {
  color: var(--muted);
  font-size: 10px;
}

.main-content {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding: calc(84px + env(safe-area-inset-top)) 16px calc(116px + env(safe-area-inset-bottom));
}

.view {
  animation: enter 180ms ease-out;
}

@keyframes enter {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.time-band,
.result-section,
.calculation-basis,
.query-controls,
.query-result,
.reference-content,
.settings-group {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.time-band {
  overflow: hidden;
  margin-bottom: 14px;
}

.date-row {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 18px 14px;
}

.solar-date {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.lunar-date {
  margin: 4px 0 0;
  color: var(--gold);
  font-size: 13px;
}

.clock-stack {
  flex: 0 0 auto;
  text-align: right;
}

.clock-stack strong {
  display: block;
  font-size: 21px;
  font-variant-numeric: tabular-nums;
}

.clock-stack span {
  color: var(--muted);
  font-size: 11px;
}

.solar-clock-row {
  min-height: 46px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  border-top: 1px solid var(--line);
  background: var(--gold-soft);
}

.solar-clock-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #765719;
  font-size: 13px;
  font-weight: 700;
}

.solar-clock-label svg {
  width: 17px;
  height: 17px;
}

#trueSolarClock {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.branch-badge,
.state-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}

.branch-badge {
  min-width: 42px;
  height: 24px;
  padding: 0 8px;
  background: #fff;
  color: var(--cinnabar);
}

.pillars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
}

.pillars > div {
  min-width: 0;
  padding: 12px 4px 14px;
  text-align: center;
}

.pillars > div + div {
  border-left: 1px solid var(--line);
}

.pillars span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
}

.pillars strong {
  font-size: 21px;
  font-weight: 700;
}

.pillars > div:nth-child(1) strong { color: #97671f; }
.pillars > div:nth-child(2) strong { color: var(--jade); }
.pillars > div:nth-child(3) strong { color: var(--blue); }
.pillars > div:nth-child(4) strong { color: #6f3f79; }

.result-section {
  margin-bottom: 14px;
  padding: 18px;
}

.linggui-section {
  border-top: 3px solid var(--cinnabar);
}

.ziwu-section {
  border-top: 3px solid var(--blue);
}

.section-heading-row,
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.section-heading-row h2,
.view-header h2 {
  margin: 0;
  font-size: 18px;
}

.section-icon {
  width: 20px;
  color: var(--muted);
}

.auto-state-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 14px -18px 0;
  padding: 9px 18px;
  border-block: 1px solid #eadcae;
  background: #faf7e8;
  color: #59635e;
  font-size: 12px;
}

.auto-state-row strong {
  padding: 4px 8px;
  border-radius: 5px;
  background: #d7821c;
  color: #fff;
  font-weight: 700;
}

.acupoint-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1fr);
  align-items: stretch;
  gap: 8px;
  margin-top: 12px;
}

.gua-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--line);
}

.gua-symbol {
  font-size: 28px;
  line-height: 1;
}

.gua-name {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.point-block {
  min-width: 0;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 6px;
  border-radius: 6px;
  text-align: center;
}

.main-point {
  background: var(--blue-soft);
  color: #1f58ae;
}

.paired-point {
  background: #f4edf7;
  color: #76238f;
}

.point-role {
  font-size: 10px;
  font-weight: 700;
}

.point-block strong {
  margin: 2px 0 3px;
  font-size: 25px;
  font-weight: 700;
  line-height: 1.2;
}

.point-block > span:last-child {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
}

.pair-arrow {
  width: 19px;
  align-self: center;
  color: var(--muted);
}

.section-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.calculation-basis {
  margin-bottom: 14px;
  padding: 16px 18px;
}

.basis-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.basis-title-row h2 {
  margin: 0;
  font-size: 15px;
}

.basis-title-row span {
  color: var(--cinnabar);
  font-size: 11px;
}

.calculation-detail {
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.calculation-detail p {
  margin: 5px 0;
}

.calculation-detail strong,
.calculation-detail b {
  color: var(--ink);
}

.state-chip {
  min-width: 48px;
  height: 26px;
  padding: 0 10px;
  background: #ecefed;
  color: var(--muted);
}

.state-chip.open {
  background: var(--jade-soft);
  color: var(--jade);
}

.najia-band {
  margin: 14px -18px 16px;
  padding: 11px 18px 13px;
  border-block: 1px solid #eadcae;
  background: #faf7e8;
}

.najia-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 12px;
}

.najia-title-row strong {
  padding: 4px 8px;
  border-radius: 5px;
  background: #d7821c;
  color: #fff;
}

.najia-points {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: 18px;
  margin-top: 12px;
  text-align: center;
}

.najia-points > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.najia-points span,
.najia-points small {
  color: var(--muted);
  font-size: 10px;
}

.najia-points strong {
  color: var(--blue);
  font-size: 21px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.najia-points > div:last-child strong {
  color: #76238f;
}

.najia-band > p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.nazi-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
}

.nazi-header span,
.nazi-header small {
  display: block;
}

.nazi-header span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.nazi-header small,
.nazi-header label {
  color: var(--muted);
  font-size: 10px;
}

.nazi-select {
  height: 44px;
  margin-top: 7px;
  padding: 0 10px;
  font-size: 13px;
}

.nazi-current {
  display: grid;
  gap: 4px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #eadcae;
  border-radius: 6px;
  background: #fbf6df;
  text-align: center;
}

.nazi-current span {
  color: var(--muted);
  font-size: 11px;
}

.nazi-current strong {
  color: #a54e12;
  font-size: 12px;
}

.nazi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.nazi-item {
  min-width: 0;
  min-height: 104px;
  display: grid;
  align-content: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfb;
}

.nazi-item span,
.nazi-item strong,
.nazi-item small {
  display: block;
}

.nazi-item span {
  color: var(--muted);
  font-size: 10px;
}

.nazi-item strong {
  margin: 3px 0;
  font-size: 18px;
  font-weight: 700;
}

.nazi-item small {
  color: var(--muted);
  font-size: 10px;
}

.nazi-item.mother { border-color: #a8d5c8; background: #edf8f1; }
.nazi-item.mother strong { color: var(--jade); }
.nazi-item.child { border-color: #e5b9b5; background: #fbeeee; }
.nazi-item.child strong { color: var(--cinnabar); }
.nazi-item.own { border-color: #b7cde0; background: #edf4fa; }
.nazi-item.own strong { color: var(--blue); }
.nazi-item.original { border-color: #d7c0dc; background: #f6eff9; }
.nazi-item.original strong { color: #6f3f79; }

.view-header {
  min-height: 48px;
  margin-bottom: 12px;
}

.view-header h2 {
  font-size: 22px;
}

.text-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border-radius: 6px;
  background: transparent;
  color: var(--jade);
  font-weight: 700;
}

.query-controls {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.control-field > span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.control-field input,
.control-field select {
  height: 46px;
  padding: 0 12px;
}

.city-picker-button {
  width: 100%;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid #cbd3ce;
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.city-picker-button span,
.city-picker-button strong,
.city-picker-button small {
  min-width: 0;
  display: block;
}

.city-picker-button strong { font-size: 14px; }
.city-picker-button small { margin-top: 1px; color: var(--muted); font-size: 10px; }
.city-picker-button > svg { width: 17px; flex: 0 0 17px; color: var(--muted); }

.segmented-control,
.mini-segmented {
  display: grid;
  overflow: hidden;
  padding: 3px;
  border-radius: 6px;
  background: #e8ece9;
}

.segmented-control {
  grid-template-columns: repeat(2, 1fr);
}

.segmented-control button,
.mini-segmented button {
  min-width: 0;
  min-height: 36px;
  padding: 6px 8px;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.segmented-control button.selected,
.mini-segmented button.selected {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(32, 39, 36, 0.12);
}

.query-result {
  min-height: 140px;
  margin-top: 14px;
  padding: 18px;
}

.query-empty {
  min-height: 100px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.query-summary {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.query-summary span {
  color: var(--muted);
  font-size: 12px;
}

.query-summary strong {
  display: block;
  margin-top: 2px;
  font-size: 17px;
}

.query-result-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0;
}

.query-point {
  padding: 13px;
  border-radius: 6px;
  text-align: center;
}

.query-point:first-child { background: var(--cinnabar-soft); color: var(--cinnabar); }
.query-point:last-child { background: var(--jade-soft); color: var(--jade); }
.query-point span,
.query-point strong { display: block; }
.query-point span { font-size: 10px; }
.query-point strong { font-size: 23px; font-weight: 700; }

.query-lines {
  display: grid;
  gap: 8px;
}

.query-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
}

.query-line:last-child { border-bottom: 0; }
.query-line span { color: var(--muted); font-size: 12px; }
.query-line strong { text-align: right; font-size: 13px; }

.reference-tabs {
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 12px;
}

.reference-content {
  overflow: hidden;
  padding: 6px 16px;
}

.reference-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  min-height: 74px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.reference-item:last-child { border-bottom: 0; }

.reference-badge {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--gold-soft);
  color: #765719;
  font-size: 20px;
  font-weight: 700;
}

.reference-main {
  min-width: 0;
}

.reference-main strong,
.reference-main span {
  display: block;
}

.reference-main strong { font-size: 15px; }
.reference-main span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.reference-pair { color: var(--jade); font-size: 12px; font-weight: 700; text-align: right; }

.song-block {
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.song-block:last-child { border-bottom: 0; }
.song-block h3 { margin: 0 0 8px; font-size: 15px; }
.song-block p { margin: 0; color: #4d5752; font-size: 15px; line-height: 1.9; white-space: pre-line; }

.settings-group {
  overflow: hidden;
  margin-bottom: 14px;
}

.settings-group > h3 {
  margin: 0;
  padding: 13px 16px 8px;
  color: var(--muted);
  font-size: 12px;
}

.settings-row {
  width: 100%;
  min-height: 64px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 15px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
}

.settings-row > svg {
  width: 17px;
  color: var(--muted);
}

.settings-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #edf0ee;
  color: var(--jade);
}

.settings-icon svg { width: 18px; }

.settings-row strong,
.settings-row small {
  display: block;
}

.settings-row strong { font-size: 14px; }
.settings-row small { margin-top: 2px; color: var(--muted); font-size: 11px; }

.select-row select {
  width: 112px;
  height: 36px;
  padding: 0 7px;
  font-size: 12px;
}

.toggle-row input {
  width: 44px;
  height: 24px;
  accent-color: var(--jade);
}

.permission-disclosure {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 11px 15px;
  border-top: 1px solid var(--line);
  background: #f8faf8;
  color: var(--muted);
  font-size: 11px;
}

.permission-disclosure svg {
  width: 16px;
  flex: 0 0 16px;
  color: var(--jade);
}

.mini-segmented {
  grid-template-columns: repeat(2, 38px);
}

.mini-segmented button {
  min-height: 30px;
  padding: 3px;
  font-size: 12px;
}

.license-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.license-summary > div {
  min-width: 0;
  min-height: 70px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
}

.license-summary > div:nth-child(odd) { border-right: 1px solid var(--line); }
.license-summary > div:nth-last-child(-n+2) { border-bottom: 0; }
.license-summary span,
.license-summary strong { display: block; }
.license-summary span { color: var(--muted); font-size: 10px; }
.license-summary strong { margin-top: 5px; overflow-wrap: anywhere; font-size: 12px; }

.medical-note {
  display: grid;
  grid-template-columns: 21px 1fr;
  gap: 9px;
  padding: 14px;
  border-left: 3px solid var(--gold);
  background: var(--gold-soft);
  color: #604a24;
  font-size: 11px;
}

.medical-note svg { width: 19px; }
.medical-note p { margin: 0; }
.version-line { margin: 18px 0 0; color: var(--muted); text-align: center; font-size: 10px; }

.picker-open { overflow: hidden; }

.city-picker {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.city-picker[hidden] { display: none; }

.city-picker-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  border: 0;
  background: rgba(20, 27, 24, 0.48);
}

.city-picker-sheet {
  position: relative;
  width: min(100%, 760px);
  height: min(76vh, 680px);
  height: min(76dvh, 680px);
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  padding: 16px 16px calc(12px + env(safe-area-inset-bottom));
  border-radius: 8px 8px 0 0;
  background: var(--surface);
  box-shadow: 0 -8px 30px rgba(20, 27, 24, 0.18);
}

.city-picker-header {
  min-height: 52px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.city-picker-header h2 { margin: 0; font-size: 18px; }
.city-picker-header p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }

.city-search {
  height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid #cbd3ce;
  border-radius: 6px;
  background: #f8faf8;
}

.city-search svg { width: 17px; flex: 0 0 17px; color: var(--muted); }
.city-search input { height: 40px; padding: 0; border: 0; background: transparent; }
.city-search input:focus-visible { outline: 0; }

.city-search-summary {
  min-height: 32px;
  padding: 8px 2px 5px;
  color: var(--muted);
  font-size: 10px;
}

.city-results {
  min-height: 0;
  overflow-y: auto;
  border-top: 1px solid var(--line);
}

.city-result {
  width: 100%;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 4px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.city-result span,
.city-result strong,
.city-result small { min-width: 0; display: block; }
.city-result strong { font-size: 14px; }
.city-result small { margin-top: 1px; color: var(--muted); font-size: 10px; }
.city-result:active { background: var(--jade-soft); }
.city-code { flex: 0 0 auto; color: var(--muted); font-family: Consolas, monospace; font-size: 10px; }

.bottom-nav {
  position: fixed;
  z-index: 20;
  inset: auto 0 0;
  height: calc(66px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 5px max(8px, calc((100% - 760px) / 2)) env(safe-area-inset-bottom);
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
}

.bottom-nav button {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  color: #7a837e;
  font-size: 10px;
}

.bottom-nav button svg {
  width: 21px;
  height: 21px;
}

.bottom-nav button.active {
  color: var(--jade);
  font-weight: 700;
}

@media (min-width: 620px) {
  .query-controls {
    grid-template-columns: 1fr 1fr;
  }

  .query-controls .primary-button {
    align-self: end;
  }
}

@media (max-width: 365px) {
  .main-content {
    padding-left: 12px;
    padding-right: 12px;
  }

  .result-section {
    padding: 15px 12px;
  }

  .auto-state-row,
  .najia-band {
    margin-left: -12px;
    margin-right: -12px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .acupoint-pair {
    grid-template-columns: minmax(0, 1fr) 16px minmax(0, 1fr);
    gap: 5px;
  }

  .point-block strong {
    font-size: 22px;
  }

  .nazi-header {
    align-items: end;
  }

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

  .topbar-title {
    gap: 7px;
  }

  .topbar h1 {
    font-size: 17px;
  }

  .status-button {
    max-width: 124px;
    padding-left: 8px;
  }
}
