:root {
  --bg: #f1ece3;
  --card: #fffdf8;
  --card-2: #f7f2e9;
  --input-bg: #f6f1e8;
  --text: #282219;
  --muted: #8c8070;
  --line: rgba(40, 34, 25, 0.10);
  --line-strong: rgba(40, 34, 25, 0.16);
  --accent: #8c2f1d;
  --accent-2: #b8863b;
  --accent-soft: rgba(140, 47, 29, 0.09);
  --accent-soft-2: rgba(184, 134, 59, 0.16);
  --shadow: 0 6px 22px rgba(64, 48, 28, 0.10);
  --shadow-lg: 0 14px 40px rgba(64, 48, 28, 0.18);
  --seg-bg: rgba(40, 34, 25, 0.06);
  --wx-mu: #2f8f58;
  --wx-huo: #cf4436;
  --wx-tu: #8f5521;
  --wx-jin: #d9a520;
  --wx-shui: #3575b3;
  --ok: #2f8f58;
  --danger: #c63d32;
  --radius: 18px;
  --radius-sm: 12px;
  --appbar-h: 64px;
}
button:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible,a:focus-visible{outline:3px solid var(--accent);outline-offset:3px}

html[data-theme="dark"] {
  --bg: #16120e;
  --card: #201b15;
  --card-2: #282219;
  --input-bg: #2a241c;
  --text: #efe6d8;
  --muted: #a29584;
  --line: rgba(255, 246, 232, 0.09);
  --line-strong: rgba(255, 246, 232, 0.16);
  --accent: #cf5c3f;
  --accent-2: #d8a45c;
  --accent-soft: rgba(207, 92, 63, 0.16);
  --accent-soft-2: rgba(216, 164, 92, 0.16);
  --shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 14px 40px rgba(0, 0, 0, 0.5);
  --seg-bg: rgba(255, 246, 232, 0.08);
  --wx-mu: #4fbf7c;
  --wx-huo: #e66a52;
  --wx-tu: #cf8a3d;
  --wx-jin: #f4cf5f;
  --wx-shui: #5f9fd6;
  --ok: #4fbf7c;
  --danger: #e06a56;
}

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

html {
  font-size: 16px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

button, input, select {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
}

button:active {
  transform: scale(0.97);
}

input, select {
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  height: 46px;
  padding: 0 14px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input[type="date"], input[type="time"] {
  -webkit-appearance: none;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' stroke='%238c8070' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}

::-webkit-calendar-picker-indicator {
  opacity: 0.55;
}

/* ---------- App Bar ---------- */
.appbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}

.appbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: var(--appbar-h);
  padding: 0 16px;
  padding-top: env(safe-area-inset-top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.brand-logo {
  color: var(--accent);
  flex: none;
}

.brand-text h1 {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.brand-text p {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.appbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  background: var(--seg-bg);
}

html[data-theme="light"] #themeMoon,
html[data-theme="dark"] #themeSun {
  display: none;
}

/* ---------- Segmented Control ---------- */
.seg {
  display: flex;
  background: var(--seg-bg);
  border-radius: 12px;
  padding: 3px;
  gap: 3px;
  width: 100%;
}

.seg button {
  flex: 1;
  height: 38px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--muted);
  transition: all 0.22s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seg button.active {
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(40, 34, 25, 0.12);
}

.seg-sm {
  width: auto;
  border-radius: 10px;
}

.seg-sm button {
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 8px;
  flex: none;
}

/* ---------- Layout ---------- */
.app-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 16px calc(150px + env(safe-area-inset-bottom));
}

.panel {
  animation: fadeUp 0.3s ease both;
  scroll-margin-top: calc(var(--appbar-h) + 12px);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 16px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
}

.field {
  margin-bottom: 16px;
}

.field:last-child {
  margin-bottom: 0;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 7px;
}

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

.field-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin: 7px 0 0;
  line-height: 1.5;
}

.link-btn {
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 0;
}

/* ---------- Search / City List ---------- */
.search-row {
  position: relative;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 6px 0 12px;
  height: 46px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-box svg {
  color: var(--muted);
  flex: none;
}

.search-box input {
  border: 0;
  box-shadow: none;
  background: transparent;
  height: 100%;
  padding: 0;
  flex: 1;
  min-width: 0;
}

.search-box input:focus {
  box-shadow: none;
}

.locate-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  flex: none;
}

.locate-btn.loading svg {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.city-list {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 320px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.city-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  min-height: 50px;
  width: 100%;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.city-item[aria-selected="true"] { background: var(--accent-soft); }

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

.city-item:active {
  background: var(--accent-soft);
}

.city-name {
  font-size: 15px;
  font-weight: 600;
}

.city-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}

.city-coord {
  font-size: 11px;
  color: var(--muted);
  flex: none;
  font-variant-numeric: tabular-nums;
}

.chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 10px;
}

.chip-main {
  font-size: 14px;
  font-weight: 600;
}

.chip-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.chip-x {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--seg-bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  flex: none;
}

/* ---------- Advanced ---------- */
.advanced {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card-2);
  padding: 0 14px;
  margin-top: 4px;
}

.advanced summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 0;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.advanced summary::-webkit-details-marker {
  display: none;
}

.advanced summary::after {
  content: "";
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.advanced[open] summary::after {
  transform: rotate(225deg);
}

.advanced .field, .advanced .switch-row {
  margin-bottom: 14px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
}

.switch-text small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.45;
}

.switch {
  width: 50px;
  height: 30px;
  border-radius: 15px;
  background: var(--line-strong);
  position: relative;
  flex: none;
  transition: background 0.25s ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
  transition: transform 0.25s ease;
}

.switch[aria-checked="true"] {
  background: var(--accent);
}

.switch[aria-checked="true"]::after {
  transform: translateX(20px);
}

/* ---------- Action Buttons ---------- */
.action-bar {
  padding: 4px 0 8px;
}

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 52px;
  border-radius: 26px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 72%, #5c1e12));
  color: #fff7ec;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  box-shadow: 0 8px 22px rgba(140, 47, 29, 0.32);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary:active {
  transform: scale(0.98);
  box-shadow: 0 4px 12px rgba(140, 47, 29, 0.28);
}

/* ---------- FAB Bar ---------- */
.fab-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 60;
  display: flex;
  gap: 10px;
  background: color-mix(in srgb, var(--card) 90%, transparent);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 7px;
  box-shadow: var(--shadow-lg);
}

.fab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 16px;
  border-radius: 22px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  white-space: nowrap;
}

.fab-primary {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 72%, #5c1e12));
  color: #fff7ec;
}

/* ---------- Result Cards ---------- */
.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 14px;
  color: var(--text);
}

.card-title::before {
  content: "";
  width: 4px;
  height: 15px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.info-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}

.info-item:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.info-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
}

.info-value {
  font-size: 14px;
  font-weight: 600;
  word-break: break-all;
}

.info-value .sub {
  font-weight: 400;
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  margin-left: 6px;
  vertical-align: 1px;
}

.badge-dst {
  background: rgba(207, 68, 54, 0.14);
  color: var(--wx-huo);
}

.badge-std {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge-none {
  background: var(--seg-bg);
  color: var(--muted);
}

.time-line {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--card-2);
  font-size: 13px;
}

.time-line .row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
}

.time-line .row span:first-child {
  color: var(--muted);
}

.time-line .row b {
  font-variant-numeric: tabular-nums;
}

/* ---------- BaZi Chart ---------- */
.chart-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -6px;
  padding: 0 6px;
  scrollbar-width: none;
}

.chart-scroll::-webkit-scrollbar {
  display: none;
}

.bazi-table {
  display: grid;
  grid-template-columns: repeat(4, minmax(78px, 1fr));
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  overflow: hidden;
  min-width: 340px;
  background: var(--card);
}

.bazi-table .row-label {
  display: none;
}

.bazi-table .bazi-row {
  display: contents;
}

.bazi-table .cell {
  text-align: center;
  padding: 8px 4px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  min-height: 34px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2px;
}

.bazi-table .cell:nth-child(4n) {
  border-right: 0;
}

.bazi-table .bazi-row:last-child .cell {
  border-bottom: 0;
}

.bazi-table .head {
  background: var(--card-2);
  font-size: 13px;
  font-weight: 700;
  padding: 10px 4px;
}

.bazi-table .head.day-head {
  background: var(--accent-soft);
  color: var(--accent);
}

.bazi-table .row-shishen .cell {
  font-size: 11px;
  color: var(--muted);
}

.bazi-table .row-gan .cell {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.15;
  padding: 7px 4px;
}

.bazi-table .row-gan .cell.day-master {
  background: var(--accent-soft);
}

.bazi-table .row-zhi .cell {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.15;
  padding: 7px 4px;
}

.bazi-table .row-zhi .cell.day-master {
  background: var(--accent-soft);
}

.bazi-table .row-hidden .cell {
  font-size: 13px;
  flex-direction: column;
  gap: 4px;
  padding: 9px 4px;
}

.hide-item {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 6px;
  line-height: 1.2;
}

.hide-ss {
  font-size: 9px;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.15;
}

.bazi-table .row-nayin .cell,
.bazi-table .row-xunkong .cell,
.bazi-table .row-dishi .cell {
  font-size: 11px;
  color: var(--muted);
}

.gz {
  font-family: "Kaiti SC", "STKaiti", "KaiTi", "TW-Kai", "FangSong", serif;
}

.gz-v {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.14;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", "TW-Kai", "FangSong", serif;
  font-weight: 700;
}

.wx-mu { color: var(--wx-mu); }
.wx-huo { color: var(--wx-huo); }
.wx-tu { color: var(--wx-tu); }
.wx-jin { color: var(--wx-jin); }
.wx-shui { color: var(--wx-shui); }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
}

.legend .item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.legend .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

/* ---------- Five Elements ---------- */
.wx-row {
  display: grid;
  grid-template-columns: 44px 1fr 54px;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
}

.wx-name {
  font-size: 14px;
  font-weight: 700;
}

.wx-track {
  height: 12px;
  border-radius: 6px;
  background: var(--seg-bg);
  overflow: hidden;
}

.wx-fill {
  display: block;
  height: 100%;
  border-radius: 6px;
  transition: width 0.5s ease;
  min-width: 3px;
}

.wx-count {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.wx-sub {
  font-size: 11px;
  color: var(--muted);
  margin: 4px 0 0;
}

/* ---------- Misc Grid ---------- */
.misc-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.misc-cell {
  background: var(--card-2);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}

.misc-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.misc-value {
  font-size: 18px;
  font-weight: 700;
}

.misc-value .gz-v {
  font-size: 19px;
}

.misc-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* ---------- Da Yun ---------- */
.dayun-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px 2px 10px;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  cursor: grab;
}

.dayun-scroll.dragging {
  cursor: grabbing;
  scroll-snap-type: none;
  user-select: none;
  -webkit-user-select: none;
}

.dayun-scroll::-webkit-scrollbar {
  display: none;
}

.dayun-card {
  flex: none;
  width: 128px;
  scroll-snap-align: start;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 10px;
  text-align: center;
  position: relative;
  transition: transform 0.15s ease;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.dayun-card:active {
  transform: scale(0.97);
}

.dayun-card:hover {
  border-color: var(--accent-2);
}

.dayun-card.current {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dayun-card .dy-age {
  font-size: 11px;
  color: var(--muted);
}

.dayun-card .dy-gz {
  font-size: 22px;
  font-weight: 700;
  margin: 4px 0 2px;
}

.dayun-card .dy-gz .gz-v {
  font-size: 22px;
  line-height: 1.12;
}

.dayun-card .dy-ss {
  font-size: 11px;
  color: var(--muted);
}

.dayun-card .dy-year {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}

.dy-badge {
  position: absolute;
  top: -7px;
  right: 8px;
  font-size: 10px;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 1px 7px;
}

.swipe-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 8px;
  opacity: 0.85;
}

.swipe-hint svg {
  animation: swipeX 1.4s ease-in-out infinite;
}

@keyframes swipeX {
  0%, 100% { transform: translateX(-3px); opacity: 0.5; }
  50% { transform: translateX(3px); opacity: 1; }
}

.liunian-panel {
  margin-top: 12px;
  background: var(--card-2);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.liunian-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 10px;
}

.liunian-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.ln-cell {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 2px;
  text-align: center;
}

.ln-cell .ln-year {
  font-size: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.ln-cell .ln-gz {
  font-size: 13px;
  font-weight: 700;
  margin: 1px 0;
}

.ln-cell .ln-gz .gz-v {
  font-size: 13px;
  line-height: 1.12;
}

.ln-cell .ln-ss {
  font-size: 10px;
  color: var(--muted);
}

.ln-cell.current-year {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* ---------- Daily Info ---------- */
.daily-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}

.daily-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
}

.daily-item span:first-child {
  color: var(--muted);
  flex: none;
}

.daily-item span:last-child {
  text-align: right;
  font-weight: 600;
}

/* ---------- Misc ---------- */
.disclaimer-card {
  background: transparent;
  box-shadow: none;
  border-style: dashed;
}

.disclaimer {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}

.page-footer {
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
  padding: 8px 0 20px;
}

.legacy-data-note {
  max-width: 860px;
  margin: 0 auto 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
  text-align: left;
}
.legacy-data-note p { margin: 0 0 6px; }
.legacy-data-note strong { color: var(--text); }
.legacy-data-note a { color: var(--accent); font-weight: 700; text-underline-offset: 3px; }
.legacy-data-note a:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.desktop-install { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-left: 12px; }
.desktop-install-btn { padding: 4px 9px; border: 1px solid var(--line-strong); border-radius: 999px; background: transparent; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; }
.desktop-install-help { flex-basis: 100%; margin: 3px 0 0; color: var(--muted); }
.desktop-install-help[hidden], .desktop-install[hidden] { display: none; }
@media (max-width: 520px) { .desktop-install { display: flex; margin: 8px 0 0; } }

.page-footer .credit {
  margin: 2px 0 0;
  opacity: 0.8;
}

@media (min-width: 640px) {
  .appbar-inner { padding-left: 24px; padding-right: 24px; }
  .app-main { padding-left: 24px; padding-right: 24px; }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(16px);
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 100;
  max-width: calc(100vw - 48px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Responsive ---------- */
@media (min-width: 768px) {
  :root {
    --appbar-h: 72px;
  }

  .app-main {
    padding-top: 24px;
  }

  .card {
    padding: 24px 26px;
  }

  #inputPanel .card {
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
  }

  #inputPanel .action-bar {
    max-width: 760px;
    margin: 0 auto;
  }

  .result-grid {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 16px;
    align-items: start;
  }

  .result-grid .card {
    margin-bottom: 0;
  }

  .result-grid .col {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
  }

  .bazi-table {
    min-width: 0;
    grid-template-columns: repeat(4, minmax(90px, 1fr));
  }

  .dayun-card {
    width: 148px;
  }

  .swipe-hint {
    display: none;
  }

  .fab-bar {
    bottom: calc(24px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 380px) {
  .brand-text p {
    display: none;
  }

  .seg-sm button {
    padding: 0 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
