:root {
  color-scheme: dark;
  --bg-top: #151511;
  --bg-bottom: #070806;
  --surface: rgba(246, 241, 229, 0.075);
  --surface-strong: rgba(246, 241, 229, 0.12);
  --surface-soft: rgba(246, 241, 229, 0.045);
  --border: rgba(246, 241, 229, 0.11);
  --border-strong: rgba(246, 241, 229, 0.2);
  --text: #f5f1e8;
  --muted: rgba(245, 241, 232, 0.54);
  --muted-strong: rgba(245, 241, 232, 0.75);
  --accent: #eee6d8;
  --accent-soft: rgba(238, 230, 216, 0.14);
  --accent-text: #171713;
  --shadow: 0 34px 120px rgba(0, 0, 0, 0.42);
  --panel-shadow: 0 18px 56px rgba(0, 0, 0, 0.28);
  --radius-panel: 34px;
  --radius-card: 22px;
  --radius-pill: 999px;
  --item-height: 56px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 22%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom) 72%);
  color: var(--text);
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "SF Pro Display",
    "PingFang SC",
    "Hiragino Sans GB",
    "Microsoft YaHei",
    sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 42px 42px;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

input,
textarea {
  border: 0;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
.wheel-picker:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}

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

.app-shell,
.entry-screen,
.dashboard-screen {
  min-height: 100dvh;
}

.entry-screen {
  display: grid;
  align-items: center;
  padding: 30px 18px;
}

.entry-wrap {
  width: min(100%, 438px);
  margin: 0 auto;
}

.entry-appbar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(env(safe-area-inset-top) + 4px) 0 14px;
}

.entry-brand {
  color: rgba(245, 241, 232, 0.66);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
}

.entry-card,
.sidebar,
.view-panel,
.unified-panel {
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.095), rgba(255, 255, 255, 0.045)),
    var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(34px) saturate(1.12);
  -webkit-backdrop-filter: blur(34px) saturate(1.12);
}

.entry-card {
  position: relative;
  overflow: hidden;
  padding: 18px 16px 16px;
  border-radius: var(--radius-panel);
}

.entry-card::before {
  content: "";
  position: absolute;
  inset: 1px 1px auto;
  height: 72px;
  border-radius: calc(var(--radius-panel) - 1px) calc(var(--radius-panel) - 1px) 18px 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent);
  pointer-events: none;
}

.entry-card > * {
  position: relative;
  z-index: 1;
}

.mode-row {
  margin-bottom: 14px;
}

.access-key-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  margin-bottom: 12px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.16);
}

.access-key-input {
  min-width: 0;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  font-size: 12px;
}

.access-key-input::placeholder {
  color: rgba(245, 241, 232, 0.38);
}

.key-button {
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(245, 241, 232, 0.1);
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 650;
}

.key-button-primary {
  background: rgba(245, 241, 232, 0.18);
  color: var(--text);
}
.key-button-copy {
  background: rgba(245, 241, 232, 0.13);
  color: var(--text);
  font-size: 11px;
}

.key-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  padding: 10px 22px;
  border-radius: 999px;
  background: rgba(245, 241, 232, 0.18);
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.26s ease;
}

.key-toast.show {
  opacity: 1;
}

.freemium-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(245, 241, 232, 0.08);
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 600;
}

.freemium-lock {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 20px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
}

.access-key-hint {
  min-height: 18px;
  margin: -4px 4px 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.mode-panels {
  display: grid;
}

.mode-panel {
  display: none;
  gap: 10px;
}

.mode-panel.active {
  display: grid;
}

.segment-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 0;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.055),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}

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

.segment-button {
  height: 36px;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

.segment-button.active {
  background: rgba(245, 241, 232, 0.16);
  color: var(--text);
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.segment-button:active,
.primary-button:active,
.ghost-button:active,
.side-tab:active {
  transform: translateY(1px);
}

.datetime-card {
  padding: 16px 8px 12px;
  border: 0;
  border-radius: var(--radius-card);
  background: transparent;
}

.datetime-head {
  display: grid;
  gap: 8px;
  padding: 0 8px 10px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.12em;
}

.datetime-head-4,
.wheel-stage-4 {
  grid-template-columns: 1.35fr repeat(3, minmax(0, 1fr));
}

.datetime-head-5,
.wheel-stage-5 {
  grid-template-columns: 1.24fr repeat(4, minmax(0, 1fr));
}

.wheel-stage {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 0 4px;
}

.wheel-stage::before,
.wheel-stage::after {
  content: "";
  position: absolute;
  right: 4px;
  left: 4px;
  z-index: 3;
  height: var(--item-height);
  pointer-events: none;
}

.wheel-stage::before {
  top: 0;
  background: linear-gradient(180deg, rgba(16, 16, 13, 0.92), rgba(16, 16, 13, 0));
}

.wheel-stage::after {
  bottom: 0;
  background: linear-gradient(0deg, rgba(16, 16, 13, 0.92), rgba(16, 16, 13, 0));
}

.matrix-highlight {
  position: absolute;
  right: 4px;
  left: 4px;
  top: var(--item-height);
  z-index: 2;
  height: var(--item-height);
  border-top: 1px solid rgba(245, 241, 232, 0.16);
  border-bottom: 1px solid rgba(245, 241, 232, 0.14);
  border-radius: 20px;
  background: rgba(245, 241, 232, 0.07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.wheel-picker {
  position: relative;
  z-index: 1;
  height: calc(var(--item-height) * 3);
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 22px;
  background: rgba(0, 0, 0, 0.16);
  scroll-snap-type: y mandatory;
  overscroll-behavior: contain;
  touch-action: none;
  cursor: grab;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.wheel-picker.dragging {
  cursor: grabbing;
  scroll-snap-type: none;
}

.wheel-picker::-webkit-scrollbar {
  display: none;
}

.wheel-track {
  padding: var(--item-height) 0;
}

.wheel-item {
  display: grid;
  place-items: center;
  height: var(--item-height);
  padding: 0 8px;
  color: rgba(245, 241, 232, 0.28);
  font-size: 19px;
  font-weight: 500;
  scroll-snap-align: center;
  user-select: none;
  transition:
    color 0.18s ease,
    opacity 0.18s ease,
    transform 0.18s ease;
}

.wheel-item.active {
  color: var(--text);
  opacity: 1;
  font-size: 24px;
  font-weight: 650;
  transform: scale(1.02);
}

.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.panel-toolbar-note {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.12em;
}

.chip-button,
.bazi-range-chip,
.ghost-inline-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--text);
}

.chip-button,
.bazi-range-chip {
  background: var(--accent-soft);
  color: var(--text);
}

.ghost-inline-button {
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted-strong);
}

.bazi-card {
  display: grid;
  gap: 14px;
  padding: 16px 8px 10px;
  border: 0;
  border-radius: var(--radius-card);
  background: transparent;
}

.bazi-pillar-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.bazi-pillar {
  display: grid;
  justify-items: center;
  gap: 10px;
  cursor: pointer;
}

.bazi-pillar-label {
  color: var(--muted-strong);
  font-size: 12px;
  letter-spacing: 0.12em;
}

.bazi-token {
  width: 62px;
  height: 62px;
  border-radius: 24px;
  background: rgba(0, 0, 0, 0.16);
  color: rgba(244, 241, 234, 0.4);
  font-size: 24px;
  font-weight: 700;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

.bazi-pillar:hover .bazi-token {
  transform: translateY(-1px);
}

.bazi-token.active {
  background: var(--accent-soft);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(238, 230, 216, 0.18);
}

.bazi-token.filled {
  color: var(--text);
}

.bazi-range-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.selector-section {
  display: grid;
}

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

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

.selector-grid-branches {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.selector-grid-pairs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-height: 220px;
  overflow-y: auto;
  padding-right: 2px;
  overscroll-behavior: contain;
}

.selector-button {
  height: 60px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.16);
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  transition:
    transform 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease;
}

.selector-button.active {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(238, 230, 216, 0.18);
}

.selector-button.stem-wood {
  color: #57d58c;
}

.selector-button.stem-fire {
  color: #ff6969;
}

.selector-button.stem-earth {
  color: #e8aa57;
}

.selector-button.stem-metal {
  color: #f0d45c;
}

.selector-button.stem-water {
  color: #4aa8ff;
}

.selector-button.branch-default {
  color: var(--muted-strong);
}

.selector-pair-button {
  display: grid;
  place-items: center;
  gap: 2px;
  height: 58px;
  padding: 6px 4px;
}

.selector-pair-main {
  font-size: 18px;
  line-height: 1;
}

.selector-pair-meta {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
}

.selector-empty-state {
  grid-column: 1 / -1;
  min-height: 58px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.14);
  color: var(--muted-strong);
  font-size: 13px;
}

.entry-divider {
  height: 1px;
  margin: 16px 8px;
  background: linear-gradient(90deg, transparent, rgba(245, 241, 232, 0.14), transparent);
}

.lunar-leap-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  color: var(--muted-strong);
  font-size: 12px;
}

.lunar-leap-inline input {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}

.solar-place-row {
  display: grid;
  position: relative;
  z-index: 50;
  margin-top: 12px;
  align-items: center;
}

.location-input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.16);
  color: var(--text);
}

.location-input::placeholder,
.composer-field textarea::placeholder {
  color: rgba(244, 241, 234, 0.36);
}

.location-hint {
  min-height: 0;
  margin: 6px 2px 0;
  color: #e8c788;
  font-size: 12px;
  line-height: 1.4;
}

.location-hint:empty {
  display: none;
}

.location-picker {
  position: relative;
  width: 100%;
}

.location-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 0;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.16);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.18s ease;
}

.location-trigger:hover {
  background: rgba(255, 255, 255, 0.08);
}

.location-trigger.open {
  border-radius: 18px 18px 0 0;
  background: rgba(0, 0, 0, 0.28);
}

.location-trigger-text {
  color: var(--text);
  font-weight: 500;
}

.location-trigger-text.placeholder {
  color: rgba(244, 241, 234, 0.36);
}

.location-chevron {
  color: var(--muted);
  transition: transform 0.18s ease;
  flex-shrink: 0;
}

.location-trigger.open .location-chevron {
  transform: rotate(180deg);
}

.location-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  border-radius: 0 0 18px 18px;
  background: rgba(20, 20, 16, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.location-columns {
  display: grid;
  grid-template-columns: 120px 1fr;
  height: 320px;
}

.location-province-list {
  overflow-y: auto;
  padding: 4px 0;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.1);
}

.location-province-list::-webkit-scrollbar,
.location-city-list::-webkit-scrollbar {
  width: 3px;
}

.location-province-list::-webkit-scrollbar-thumb,
.location-city-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

.location-province-item {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease;
  white-space: nowrap;
}

.location-province-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.location-province-item.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  font-weight: 600;
}

.location-city-list {
  overflow-y: auto;
  padding: 4px 0;
}

.location-city-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}

.location-city-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.location-city-item.selected {
  background: rgba(200, 180, 140, 0.16);
  color: #e8c788;
}

.location-empty-hint {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--muted);
  font-size: 13px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding: 4px 2px 0;
}

.toggle-label,
.eyebrow,
.panel-kicker,
.section-headline,
.message-meta,
.pillar-label,
.fortune-card span,
.insight-card span {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.1em;
}

.solar-inline {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.solar-inline input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.solar-switch {
  position: relative;
  width: 52px;
  height: 32px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.2);
  transition: background 0.18s ease;
}

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

.solar-inline input:checked + .solar-switch {
  background: rgba(238, 230, 216, 0.32);
}

.solar-inline input:checked + .solar-switch::after {
  transform: translateX(20px);
}

.primary-button,
.ghost-button,
.side-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  transition:
    transform 0.16s ease,
    background 0.16s ease,
    color 0.16s ease,
    border-color 0.16s ease;
}

.primary-button {
  width: 100%;
  height: 54px;
  margin-top: 18px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 720;
  letter-spacing: 0.05em;
  box-shadow:
    0 18px 36px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.primary-button:hover,
.segment-button:hover,
.side-tab:hover,
.ghost-button:hover,
.chip-button:hover,
.bazi-range-chip:hover,
.ghost-inline-button:hover {
  transform: translateY(-1px);
}

.dashboard-screen {
  padding: 20px;
  overflow-x: hidden;
}

.dashboard-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  width: min(100%, 1180px);
  margin: 0 auto;
  min-height: calc(100dvh - 36px);
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.sidebar {
  position: sticky;
  top: 14px;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 12px 14px;
  border-radius: 26px;
  box-shadow: var(--panel-shadow);
}

.sidebar-top h2 {
  margin-top: 4px;
  font-size: 22px;
  line-height: 1.1;
}

.profile-brief {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.brief-pill,
.overview-pill,
.tag-cloud span,
.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.065);
  color: var(--muted-strong);
  font-size: 12px;
}

.side-nav {
  display: flex;
  align-content: start;
  gap: 8px;
  margin-top: 0;
}

.side-tab,
.ghost-button {
  min-height: 42px;
  border: 0;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
}

.side-tab.active {
  background: rgba(245, 241, 232, 0.17);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.side-tab-muted {
  color: var(--muted);
}

.workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  max-width: 100%;
  overflow-x: hidden;
}

.unified-panel {
  display: grid;
  min-height: 100%;
  padding: 26px;
  border-radius: 30px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.095), rgba(255, 255, 255, 0.045)),
    var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(34px) saturate(1.12);
  -webkit-backdrop-filter: blur(34px) saturate(1.12);
}

.chat-section {
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.015) 0%, transparent 40px);
  border-radius: 0 0 0 0;
  padding: 28px 0 0 0;
}

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

.chat-section-head .panel-kicker {
  font-size: 13px;
  color: #e8c788;
  letter-spacing: 0.12em;
}

.ghost-back-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  min-height: 42px;
  border: 0;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease;
}

.ghost-back-button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.09);
}

.view-panel {
  display: grid;
  min-height: 100%;
  padding: 26px;
  border-radius: 30px;
  box-shadow: var(--panel-shadow);
}

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

.view-head h3 {
  margin-top: 8px;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: 0;
}

.overview-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.overview-pill {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.ai-brief-card {
  display: grid;
  grid-template-columns: minmax(180px, 0.72fr) minmax(0, 1.28fr);
  gap: 18px;
  align-items: center;
  margin-top: 18px;
  padding: 18px;
  border-radius: 26px;
  background:
    linear-gradient(135deg, rgba(245, 241, 232, 0.12), rgba(245, 241, 232, 0.045)),
    rgba(0, 0, 0, 0.12);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 18px 52px rgba(0, 0, 0, 0.18);
}

.ai-brief-copy {
  display: grid;
  gap: 8px;
}

.ai-brief-copy h4 {
  margin: 0;
  color: var(--text);
  font-size: 23px;
  line-height: 1.15;
  letter-spacing: 0;
  text-wrap: balance;
}

.prompt-chip-row,
.quick-prompt-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.prompt-chip {
  min-height: 38px;
  padding: 0 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.065);
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 680;
  line-height: 1;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease;
}

.prompt-chip:hover {
  background: rgba(245, 241, 232, 0.16);
  color: var(--text);
  transform: translateY(-1px);
}

.prompt-chip:active {
  transform: translateY(1px);
}

.prompt-chip.primary-prompt {
  background: rgba(245, 241, 232, 0.2);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.result-section {
  margin-top: 26px;
  animation: fadeSlideIn 0.35s ease both;
}

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

.result-section:nth-child(1) { animation-delay: 0s; }
.result-section:nth-child(2) { animation-delay: 0.06s; }
.result-section:nth-child(3) { animation-delay: 0.12s; }
.result-section:nth-child(4) { animation-delay: 0.18s; }

.section-headline {
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: inline-block;
  margin-bottom: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .result-section {
    animation: none;
  }
}

.pillar-grid,
.relation-board,
.fortune-grid,
.insight-grid {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

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

.pillar-strip {
  --pillar-gap: clamp(18px, 5vw, 56px);
  --pillar-col: clamp(56px, 7vw, 76px);
  display: flex;
  justify-content: center;
  gap: var(--pillar-gap);
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
}

.pillar-strip .pillar-card {
  display: grid;
  justify-items: center;
  gap: 0;
  width: var(--pillar-col);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.pillar-strip .pillar-label {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.1em;
  margin: 0;
}

.pillar-strip .pillar-main {
  font-size: 34px;
  font-weight: 760;
  line-height: 1;
  letter-spacing: 0.04em;
  color: var(--text);
  margin: 0;
}

.pillar-strip .pillar-note {
  font-size: 10px;
  color: var(--muted-strong);
  line-height: 1.2;
  text-align: center;
  margin: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tengod-strip {
  --pillar-gap: clamp(18px, 5vw, 56px);
  --pillar-col: clamp(56px, 7vw, 76px);
  display: flex;
  justify-content: center;
  gap: var(--pillar-gap);
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
  margin-top: 2px;
}

.tengod-cell {
  display: grid;
  justify-items: center;
  gap: 0;
  width: var(--pillar-col);
  padding: 0;
  text-align: center;
}

.tengod-stem {
  font-size: 12px;
  font-weight: 600;
  color: #e8c788;
}

.tengod-branch {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.2;
}

.relation-board {
  grid-template-columns: 1fr;
  min-width: 0;
}

.plate-reading-board,
.plate-brief-board {
  display: grid;
  gap: 10px;
  width: 100%;
  min-width: 0;
}

.plate-reading-hero {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 18px 16px;
  border: 1px solid rgba(232, 199, 136, 0.16);
  border-radius: 20px;
  background:
    linear-gradient(145deg, rgba(232, 199, 136, 0.12), rgba(255, 255, 255, 0.035) 36%, rgba(0, 0, 0, 0.12)),
    rgba(0, 0, 0, 0.11);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.075),
    0 18px 40px rgba(0, 0, 0, 0.2);
}

.plate-reading-hero h4 {
  margin: 0;
  color: var(--text);
  font-size: 21px;
  line-height: 1.28;
  font-weight: 780;
  letter-spacing: 0;
}

.plate-reading-hero p {
  margin: 0;
  color: rgba(245, 241, 232, 0.78);
  font-size: 14px;
  line-height: 1.82;
}

.ai-pending-card {
  border-style: dashed;
  opacity: 0.82;
  cursor: pointer;
}

.plate-evidence-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.plate-evidence-line span {
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  color: rgba(245, 241, 232, 0.72);
  font-size: 11px;
  font-weight: 650;
}

.plate-brief-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 16px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.052), rgba(255, 255, 255, 0.022)),
    rgba(0, 0, 0, 0.09);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.055),
    0 12px 28px rgba(0, 0, 0, 0.14);
}

.plate-brief-card-main {
  border: 1px solid rgba(232, 199, 136, 0.11);
}

.plate-brief-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.plate-brief-head span {
  color: #e8c788;
  font-size: 13px;
  font-weight: 680;
}

.plate-brief-head strong {
  color: rgba(245, 241, 232, 0.54);
  font-size: 12px;
  font-weight: 650;
}

.plate-brief-card p {
  margin: 0;
  color: rgba(245, 241, 232, 0.74);
  font-size: 13px;
  line-height: 1.75;
}

.plate-mini-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.plate-mini-tags span {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(232, 199, 136, 0.11);
  color: #e8c788;
  font-size: 11px;
  font-weight: 640;
}

.ai-preview-refresh {
  position: relative;
  z-index: 2;
  justify-self: start;
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(232, 199, 136, 0.14);
  color: #e8c788;
  font: inherit;
  font-size: 12px;
  font-weight: 720;
  cursor: pointer;
  touch-action: manipulation;
}

.ai-preview-refresh:active {
  transform: translateY(1px);
}

.lead-section {
  margin-top: 2px;
}

.lead-form {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(232, 199, 136, 0.1);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.044), rgba(255, 255, 255, 0.018)),
    rgba(0, 0, 0, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

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

.lead-field span {
  color: rgba(245, 241, 232, 0.56);
  font-size: 12px;
  font-weight: 650;
}

.lead-field input,
.lead-field textarea {
  width: 100%;
  border: 1px solid rgba(232, 199, 136, 0.12);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  outline: none;
}

.lead-field input {
  height: 42px;
  padding: 0 12px;
}

.lead-field textarea {
  min-height: 62px;
  resize: vertical;
  padding: 10px 12px;
}

.lead-field input:focus,
.lead-field textarea:focus {
  border-color: rgba(232, 199, 136, 0.38);
  box-shadow: 0 0 0 3px rgba(232, 199, 136, 0.08);
}

.lead-submit {
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: #e8c788;
  color: #20160c;
  font: inherit;
  font-size: 14px;
  font-weight: 760;
}

.lead-submit:disabled {
  opacity: 0.64;
}

.lead-hint {
  min-height: 18px;
  margin: 0;
  color: rgba(245, 241, 232, 0.56);
  font-size: 12px;
  line-height: 1.5;
}

.lead-hint[data-tone="success"] {
  color: #e8c788;
}

.lead-hint[data-tone="error"] {
  color: #ffb4a8;
}

.unlock-module-grid {
  display: grid;
  gap: 10px;
}

.open-reading-card {
  display: grid;
  gap: 9px;
  min-width: 0;
  padding: 15px 14px;
  border: 1px solid rgba(232, 199, 136, 0.11);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(232, 199, 136, 0.1), rgba(255, 255, 255, 0.026)),
    rgba(0, 0, 0, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.058);
}

.open-reading-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.open-reading-head span {
  color: #e8c788;
  font-size: 14px;
  font-weight: 740;
}

.open-reading-head strong {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(232, 199, 136, 0.12);
  color: rgba(232, 199, 136, 0.88);
  font-size: 10px;
  font-weight: 720;
}

.open-reading-card p {
  margin: 0;
  color: rgba(245, 241, 232, 0.74);
  font-size: 13px;
  line-height: 1.72;
}

.open-reading-card h5,
.locked-reading-card h5 {
  margin: 0 0 5px;
  color: rgba(245, 241, 232, 0.86);
  font-size: 13px;
  line-height: 1.35;
  font-weight: 720;
}

.reading-evidence-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.reading-evidence-list em {
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(245, 241, 232, 0.5);
  font-size: 10px;
  font-style: normal;
  font-weight: 620;
}

.locked-reading-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 12px;
  align-items: center;
  min-width: 0;
  padding: 14px 14px;
  border-radius: 18px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02)),
    rgba(0, 0, 0, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.locked-reading-card span {
  display: block;
  color: #e8c788;
  font-size: 14px;
  font-weight: 720;
}

.locked-reading-card p {
  margin: 5px 0 0;
  color: rgba(245, 241, 232, 0.62);
  font-size: 12px;
  line-height: 1.55;
}

.locked-reading-card strong {
  grid-column: 1 / -1;
  color: rgba(245, 241, 232, 0.42);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
}

.locked-reading-card button {
  grid-row: 1;
  grid-column: 2;
  border: 0;
  border-radius: 999px;
  padding: 8px 10px;
  background: rgba(232, 199, 136, 0.16);
  color: #e8c788;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.plate-signal-list {
  display: grid;
  gap: 8px;
}

.plate-signal-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  min-width: 0;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.045);
}

.plate-signal-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.plate-signal-item span {
  align-self: center;
  color: rgba(245, 241, 232, 0.56);
  font-size: 12px;
  font-weight: 650;
}

.plate-signal-item strong {
  color: var(--text);
  font-size: 17px;
  font-weight: 760;
  letter-spacing: 0;
}

.plate-signal-item em {
  grid-column: 1 / -1;
  color: rgba(245, 241, 232, 0.58);
  font-size: 12px;
  font-style: normal;
  line-height: 1.45;
}

.fortune-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-width: 0;
}

.current-fortune-card {
  grid-column: 1 / -1;
}

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

.pillar-card,
.relation-group,
.fortune-card,
.insight-card,
.message-bubble {
  border: 0;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.055);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.055);
}

.pillar-card,
.relation-group,
.fortune-card,
.insight-card {
  padding: 16px;
  transition: background 0.2s ease, transform 0.2s ease;
}

.fortune-card:hover {
  background: rgba(255, 255, 255, 0.07);
}

.relation-group {
  background: rgba(255, 255, 255, 0.048);
  transition: background 0.2s ease;
}

.relation-group:hover {
  background: rgba(255, 255, 255, 0.065);
}

.relation-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.relation-group-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.relation-group-meta {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
}

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

.relation-chip {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 0;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.12);
}

.relation-chip-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.relation-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.08em;
  background: rgba(255, 255, 255, 0.075);
  color: var(--text);
}

.relation-pill.formed {
  background: rgba(126, 190, 153, 0.14);
  color: #b9dcc8;
}

.relation-pill.rising {
  background: rgba(126, 162, 192, 0.14);
  color: #c2d1dc;
}

.relation-pill.pending {
  background: rgba(211, 186, 130, 0.14);
  color: #e4d2ad;
}

.relation-pill.hidden {
  background: rgba(176, 156, 199, 0.14);
  color: #d3c8dc;
}

.relation-pill.active {
  background: rgba(255, 255, 255, 0.14);
  color: var(--text);
}

.relation-strength {
  color: var(--muted);
  font-size: 12px;
}

.relation-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.relation-pattern {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: 0.06em;
}

.relation-arrow {
  color: var(--muted);
  font-size: 14px;
}

.relation-target {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted-strong);
  font-size: 12px;
}

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

.relation-empty {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.pillar-main {
  margin-top: 12px;
  font-size: 38px;
  line-height: 1;
  letter-spacing: 0;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
}

.pillar-note,
.fortune-card p,
.insight-card p {
  margin-top: 10px;
  color: var(--muted-strong);
  font-size: 13px;
  line-height: 1.7;
}

.fortune-card strong,
.insight-card strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 680;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.tag-cloud span {
  background: rgba(200, 180, 140, 0.1);
  border: 1px solid rgba(200, 180, 140, 0.18);
  color: #e8c788;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.shensha-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  width: 100%;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid rgba(245, 241, 232, 0.055);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.032), rgba(255, 255, 255, 0.012)),
    rgba(0, 0, 0, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 12px 28px rgba(0, 0, 0, 0.16);
}

.shensha-column {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
  padding: 12px 6px;
  border-right: 1px solid rgba(255, 255, 255, 0.035);
}

.shensha-column:last-child {
  border-right: 0;
}

.shensha-column strong {
  display: block;
  margin-bottom: 3px;
  color: rgba(245, 241, 232, 0.42);
  font-size: 11px;
  font-weight: 650;
  line-height: 1;
  text-align: center;
}

.shensha-column span {
  display: block;
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #e8c788;
  font-size: 13px;
  font-weight: 560;
  line-height: 1.35;
  letter-spacing: 0.02em;
  text-align: center;
  overflow-wrap: anywhere;
}

.shensha-column em {
  color: rgba(245, 241, 232, 0.26);
  font-size: 12px;
  font-style: normal;
  text-align: center;
}

.shensha-empty {
  margin-top: 10px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 13px;
}

.chat-view {
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
}

.message-list {
  display: grid;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.quick-prompt-bar {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(245, 241, 232, 0.08);
}

.message {
  display: grid;
  gap: 8px;
  max-width: min(82%, 620px);
}

.message.assistant {
  justify-self: start;
}

.message.user {
  justify-self: end;
}

.message-bubble {
  padding: 16px;
  font-size: 15px;
  line-height: 1.8;
}

.message-text {
  display: grid;
  gap: 8px;
}

.message-text p {
  margin: 0;
}

.message.user .message-bubble {
  background: rgba(238, 230, 216, 0.14);
}

.attachment-preview,
.message-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attachment-preview {
  margin-top: 12px;
}

.attachment-preview figure,
.message-images figure {
  width: 72px;
  height: 72px;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
}

.attachment-preview img,
.message-images img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.composer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  padding: 6px 8px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.075);
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.composer.composer-focused {
  border-color: rgba(232, 199, 136, 0.34);
  background: rgba(255, 255, 255, 0.075);
  box-shadow:
    0 0 0 3px rgba(232, 199, 136, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.composer-field {
  flex: 1;
}

.composer-field textarea {
  width: 100%;
  min-height: 40px;
  max-height: 160px;
  padding: 11px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  resize: none;
  outline: 0;
}

.composer-attach-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease;
}

.composer-attach-button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.composer-attach-button:active {
  transform: scale(0.94);
}

.composer-send-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(245, 241, 232, 0.28);
  color: rgba(16, 16, 16, 0.72);
  cursor: pointer;
  transition:
    transform 0.16s ease,
    opacity 0.18s ease,
    background 0.18s ease,
    color 0.18s ease;
}

.composer.composer-has-content .composer-send-button {
  background: #f4f1ea;
  color: #101010;
}

.composer-send-button:hover {
  transform: scale(1.06);
}

.composer-send-button:active {
  transform: scale(0.94);
}

.composer-send-button.sending svg {
  animation: sendPulse 0.8s ease-in-out infinite alternate;
}

@keyframes sendPulse {
  from {
    opacity: 0.45;
    transform: translateY(1px);
  }
  to {
    opacity: 1;
    transform: translateY(-1px);
  }
}

.composer-send-button:disabled {
  opacity: 0.35;
  cursor: default;
  transform: none;
}

.composer-attach-button:disabled,
.composer-send-button:disabled {
  pointer-events: none;
}

.composer-field textarea:disabled {
  opacity: 0.58;
  cursor: default;
}

.primary-button:disabled,
.ghost-button:disabled {
  cursor: default;
  opacity: 0.54;
}

@media (max-width: 980px) {
  .dashboard-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }

  .side-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .pillar-strip {
    --pillar-gap: clamp(8px, 3vw, 24px);
    --pillar-col: clamp(50px, 10vw, 58px);
  }

  .pillar-strip .pillar-main {
    font-size: 26px;
  }

  .pillar-strip .pillar-card,
  .tengod-cell {
    width: var(--pillar-col);
    min-width: 0;
  }

  .tengod-strip {
    --pillar-gap: clamp(8px, 3vw, 24px);
    --pillar-col: clamp(50px, 10vw, 58px);
    gap: var(--pillar-gap);
  }

    .relation-board,
    .fortune-grid,
    .insight-grid {
      grid-template-columns: 1fr;
    }

    .fortune-grid {
      grid-auto-flow: column;
      grid-auto-columns: minmax(240px, min(76vw, 340px));
      grid-template-columns: none;
      overflow-x: auto;
      scroll-snap-type: x mandatory;
      -webkit-overflow-scrolling: touch;
      padding-bottom: 4px;
      margin: 0 -12px;
      padding: 0 12px 4px;
    }

    .fortune-grid::-webkit-scrollbar {
      height: 3px;
    }

    .fortune-grid::-webkit-scrollbar-thumb {
      background: rgba(255, 255, 255, 0.1);
      border-radius: 3px;
    }

    .fortune-card {
      scroll-snap-align: start;
      min-width: 0;
    }
  }

@media (max-width: 680px) {
  .entry-screen,
  .dashboard-screen {
    padding-right: 12px;
    padding-left: 12px;
  }

  .sidebar {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    margin-left: calc(50% - 50vw + 12px);
    margin-right: calc(50% - 50vw + 12px);
    overflow: hidden;
  }

  .entry-screen {
    padding-top: calc(env(safe-area-inset-top) + 22px);
  }

  .entry-wrap {
    width: 100%;
  }

  .entry-card {
    padding: 16px 14px 14px;
    border-radius: 30px;
  }

  .datetime-head-4,
  .wheel-stage-4 {
    grid-template-columns: 1.2fr repeat(3, minmax(0, 1fr));
  }

  .datetime-head-5,
  .wheel-stage-5 {
    grid-template-columns: 1.08fr repeat(4, minmax(0, 1fr));
  }

  .wheel-item {
    font-size: 17px;
  }

  .wheel-item.active {
    font-size: 22px;
  }

  .dashboard-screen {
    padding-top: calc(env(safe-area-inset-top) + 10px);
    padding-bottom: calc(env(safe-area-inset-bottom) + 10px);
  }

  .dashboard-shell {
    gap: 12px;
    min-height: calc(100dvh - 20px);
  }

  .sidebar {
    gap: 12px;
    padding: 14px;
    border-radius: 24px;
  }

  .unified-panel {
    padding: 0;
    border-radius: 0;
    border: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
    min-height: auto;
  }

  .view-head {
    flex-direction: column;
    margin-bottom: 14px;
  }

  .view-head h3 {
    font-size: 22px;
  }

  .bazi-pillar-grid {
    gap: 8px;
  }

  .bazi-token {
    width: 58px;
    height: 58px;
    border-radius: 20px;
    font-size: 22px;
  }

  .selector-button {
    height: 56px;
    border-radius: 16px;
  }

  .pillar-grid {
    grid-template-columns: 1fr;
  }

  .pillar-strip {
    --pillar-gap: 2px;
    --pillar-col: calc((100% - 6px) / 4);
    width: 100%;
    max-width: 100%;
    margin-inline: 0;
    overflow: hidden;
    justify-content: center;
  }

  .pillar-strip .pillar-main {
    font-size: 24px;
  }

  .pillar-strip .pillar-card,
  .tengod-cell {
    width: var(--pillar-col);
  }

  .tengod-strip {
    --pillar-gap: 2px;
    --pillar-col: calc((100% - 6px) / 4);
    width: 100%;
    max-width: 100%;
    margin-inline: 0;
    overflow: hidden;
    justify-content: center;
    gap: var(--pillar-gap);
  }

  .pillar-main {
    font-size: 30px;
  }

  .result-section {
    margin-top: 18px;
  }

  .message {
    max-width: 100%;
  }

  .chat-view {
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    min-height: calc(100dvh - 156px);
  }

  .message-list {
    padding-right: 0;
    padding-bottom: 10px;
  }

  .message-bubble {
    padding: 14px;
    font-size: 16px;
    border-radius: 20px;
  }

  .composer {
    flex-wrap: nowrap;
    position: sticky;
    bottom: 0;
    z-index: 2;
    margin-top: 10px;
    padding: 8px;
    padding-bottom: calc(env(safe-area-inset-bottom) + 8px);
    background: rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
  }

  .composer-field {
    width: auto;
    flex-basis: auto;
    order: -1;
  }

  .composer-field textarea {
    min-height: 36px;
    padding: 10px 0;
    font-size: 16px;
    border-radius: 0;
    background: transparent;
  }
}

@media (max-width: 680px) {
  html,
  body,
  .app-shell,
  .dashboard-screen,
  .dashboard-shell,
  .workspace,
  .unified-panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }

  .dashboard-screen {
    padding-right: 12px;
    padding-left: 12px;
  }

  .overview-strip {
    display: block;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    min-width: 0;
    overflow: hidden;
  }

  .overview-strip > * {
    display: inline-flex;
    margin: 0 6px 6px 0;
    overflow: hidden;
  }

  .overview-pill,
  .brief-pill,
  .status-chip {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .overview-pill {
    min-height: 30px;
    padding: 0 10px;
    font-size: 11px;
    line-height: 1.25;
  }

  .result-section:first-of-type {
    display: block;
    clear: both;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    overflow: hidden;
  }

  .pillar-strip,
  .tengod-strip {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 44px)) !important;
    justify-content: center;
    align-items: start;
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
    gap: 0 !important;
    overflow: hidden;
  }

  .pillar-strip .pillar-card,
  .tengod-cell {
    width: auto !important;
    min-width: 0;
    max-width: 44px;
  }

  .pillar-strip .pillar-main {
    font-size: 23px;
    line-height: 1;
    letter-spacing: 0;
  }

  .pillar-strip .pillar-label,
  .pillar-strip .pillar-note,
  .tengod-stem,
  .tengod-branch {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .tengod-stem {
    font-size: 11px;
  }

  .tengod-branch {
    font-size: 9px;
  }
}

.bazi-result-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 64px));
  justify-content: center;
  gap: clamp(12px, 4vw, 34px);
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.bazi-table {
  display: grid;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(245, 241, 232, 0.065);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012)),
    rgba(0, 0, 0, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.055),
    0 14px 32px rgba(0, 0, 0, 0.18);
}

.bazi-table-row {
  display: grid;
  grid-template-columns: 56px repeat(4, minmax(0, 1fr));
  min-width: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.035);
}

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

.bazi-table-row:first-child {
  border-radius: 18px 18px 0 0;
}

.bazi-table-row:last-child {
  border-radius: 0 0 18px 18px;
}

.bazi-table-row:nth-child(odd) {
  background: rgba(255, 255, 255, 0.018);
}

.bazi-table-row:nth-child(even) {
  background: rgba(255, 255, 255, 0.03);
}

.bazi-row-label,
.bazi-cell {
  display: grid;
  align-items: center;
  min-width: 0;
  padding: 10px 3px;
  color: rgba(245, 241, 232, 0.76);
  font-size: 13px;
  line-height: 1.25;
  text-align: center;
}

.bazi-row-label {
  justify-items: start;
  padding-left: 6px;
  color: rgba(245, 241, 232, 0.36);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.bazi-cell {
  justify-items: center;
  overflow-wrap: anywhere;
}

.bazi-table-row.muted-row .bazi-cell,
.bazi-table-row.soft-row .bazi-cell {
  color: rgba(245, 241, 232, 0.7);
}

.bazi-table-row.main-row .bazi-cell {
  padding-top: 12px;
  padding-bottom: 12px;
  font-size: clamp(28px, 8vw, 42px);
  font-weight: 760;
  line-height: 1;
}

.bazi-main-token {
  display: inline-block;
  line-height: 1;
}

.bazi-table-row.stem-row .bazi-cell:nth-child(2),
.bazi-table-row.branch-row .bazi-cell:nth-child(2) {
  color: #20d68f;
}

.bazi-table-row.stem-row .bazi-cell:nth-child(3),
.bazi-table-row.branch-row .bazi-cell:nth-child(3),
.bazi-table-row.stem-row .bazi-cell:nth-child(5),
.bazi-table-row.branch-row .bazi-cell:nth-child(5) {
  color: #c9893f;
}

.bazi-table-row.stem-row .bazi-cell:nth-child(4),
.bazi-table-row.branch-row .bazi-cell:nth-child(4) {
  color: #ff6464;
}

.bazi-table-row.stack-row .bazi-cell {
  align-content: center;
  gap: 3px;
  color: #e8c788;
  font-size: 12px;
  line-height: 1.22;
}

.bazi-table-row.stack-row .bazi-cell span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bazi-table-row.hidden-row .bazi-cell {
  gap: 2px;
  font-weight: 650;
}

.bazi-table-row.god-row .bazi-cell {
  gap: 2px;
  color: rgba(245, 241, 232, 0.76);
}

.bazi-table-row.shen-row .bazi-cell {
  gap: 2px;
  color: #e8c788;
  font-size: 11px;
  line-height: 1.22;
}

.bazi-table-row.fortune-state-row .bazi-cell,
.bazi-table-row.void-row .bazi-cell,
.bazi-table-row.nayin-row .bazi-cell {
  color: rgba(245, 241, 232, 0.62);
  font-size: 12px;
}

.tone-wood {
  color: #28d890;
}

.tone-fire {
  color: #ff6868;
}

.tone-earth {
  color: #c98a43;
}

.tone-metal {
  color: #e3bd54;
}

.tone-water {
  color: #45a7ff;
}

.tone-god {
  color: rgba(245, 241, 232, 0.76);
}

.tone-default {
  color: rgba(245, 241, 232, 0.72);
}

.bazi-result-board .pillar-card {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 1px;
  min-width: 0;
  width: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.bazi-result-board .pillar-label {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
  letter-spacing: 0.08em;
}

.bazi-result-board .pillar-main {
  margin: 0;
  color: var(--text);
  font-size: 32px;
  font-weight: 760;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

.bazi-result-board .pillar-note {
  max-width: 100%;
  margin: 0;
  color: var(--muted-strong);
  font-size: 9px;
  line-height: 1.2;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pillar-gods {
  display: grid;
  justify-items: center;
  gap: 0;
  min-width: 0;
  max-width: 100%;
  margin-top: 1px;
}

.pillar-god-stem {
  color: #e8c788;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 650;
}

.pillar-god-branch {
  max-width: 100%;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 680px) {
  .result-section:first-of-type {
    width: 100%;
    max-width: 100%;
    margin-right: 0;
    margin-left: 0;
    overflow: hidden;
  }

  .bazi-result-board {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    justify-content: stretch;
    gap: 0;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .bazi-result-board .pillar-main {
    font-size: clamp(20px, 6vw, 24px);
  }

  .bazi-result-board .pillar-label {
    font-size: 9px;
  }

  .bazi-result-board .pillar-note {
    font-size: 8px;
  }

  .pillar-god-stem {
    font-size: 10px;
  }

  .pillar-god-branch {
    font-size: 8px;
  }
}

/* The Bazi table owns its own columns. The wrapper must not be a 4-column grid. */
.bazi-result-board {
  display: block !important;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  overflow: hidden;
}

.bazi-result-board .bazi-table {
  width: 100%;
  max-width: 100%;
}

@media (max-width: 680px) {
  .bazi-result-board {
    display: block !important;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
  }

  .bazi-table {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .bazi-table-row {
    grid-template-columns: 52px repeat(4, minmax(0, 1fr)) !important;
    width: 100%;
    min-width: 0;
  }
}

/* Mobile dashboard rewrite: keep every result surface inside the viewport. */
@media (max-width: 680px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .app-shell,
  .dashboard-screen,
  .dashboard-shell,
  .workspace,
  .unified-panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }

  .dashboard-screen {
    display: block;
    padding: calc(env(safe-area-inset-top) + 10px) 12px calc(env(safe-area-inset-bottom) + 10px);
  }

  .dashboard-shell {
    display: block;
    margin: 0;
    min-height: auto;
  }

  .sidebar {
    position: relative;
    top: auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0 0 14px;
    padding: 14px;
    overflow: hidden;
    border-radius: 24px;
  }

  .sidebar-top,
  .profile-brief,
  .side-nav {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
  }

  .profile-brief {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .brief-pill,
  .overview-pill,
  .status-chip {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .workspace {
    display: block;
  }

  .unified-panel,
  .view-panel {
    display: block;
    min-height: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .view-head {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    margin-bottom: 12px;
    overflow: hidden;
  }

  .view-head h3 {
    font-size: 24px;
  }

  .view-head .status-chip {
    justify-self: start;
  }

  .overview-strip {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    overflow: hidden;
  }

  .overview-strip > * {
    margin: 0;
  }

  .result-section,
  .result-section:first-of-type {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 18px 0 0;
    overflow: hidden;
  }

  .bazi-result-board {
    display: block !important;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    overflow: hidden;
  }

  .bazi-table {
    width: 100%;
    max-width: 100%;
    margin: 0;
    border-radius: 16px;
    border-color: rgba(245, 241, 232, 0.055);
  }

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

  .bazi-table-row:first-child {
    border-radius: 16px 16px 0 0;
  }

  .bazi-table-row:last-child {
    border-radius: 0 0 16px 16px;
  }

  .bazi-row-label,
  .bazi-cell {
    padding-right: 2px;
    padding-left: 2px;
    font-size: 11px;
  }

  .bazi-row-label {
    padding-left: 4px;
  }

  .bazi-table-row.main-row .bazi-cell {
    font-size: clamp(24px, 7.2vw, 34px);
  }

  .bazi-table-row.stack-row .bazi-cell {
    font-size: 11px;
  }

  .bazi-table-row.hidden-row .bazi-cell,
  .bazi-table-row.god-row .bazi-cell,
  .bazi-table-row.shen-row .bazi-cell {
    gap: 1px;
    font-size: 10px;
    line-height: 1.18;
  }

  .bazi-table-row.fortune-state-row .bazi-cell,
  .bazi-table-row.void-row .bazi-cell,
  .bazi-table-row.nayin-row .bazi-cell {
    font-size: 10px;
    line-height: 1.25;
  }

  .bazi-result-board .pillar-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 0 1px;
    overflow: hidden;
  }

  .bazi-result-board .pillar-main {
    font-size: clamp(20px, 5.8vw, 24px);
    line-height: 1;
    letter-spacing: 0;
  }

  .bazi-result-board .pillar-label,
  .bazi-result-board .pillar-note,
  .pillar-god-stem,
  .pillar-god-branch {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .bazi-result-board .pillar-label {
    font-size: 9px;
  }

  .bazi-result-board .pillar-note,
  .pillar-god-branch {
    font-size: 8px;
  }

  .pillar-god-stem {
    font-size: 10px;
  }

  .relation-board,
  .fortune-grid,
  .insight-grid {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    grid-template-columns: 1fr;
    overflow: hidden;
  }

  .relation-group,
  .fortune-card {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }

  .fortune-grid {
    display: grid;
    grid-auto-flow: row;
    grid-auto-columns: unset;
    gap: 12px;
    margin: 10px 0 0;
    padding: 0;
    overflow-x: hidden;
    scroll-snap-type: none;
  }

  .tag-cloud {
    max-width: 100%;
    overflow: hidden;
  }

  .shensha-board {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
    max-width: 100%;
    border-radius: 16px;
  }

  .shensha-column {
    padding: 10px 3px;
    gap: 4px;
  }

  .shensha-column span {
    font-size: 12px;
    line-height: 1.32;
  }

  .chat-section {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
  }

  .message {
    max-width: 100%;
  }

  .composer {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    border-color: rgba(255, 255, 255, 0.075);
  }

  .composer.composer-focused {
    border-color: rgba(232, 199, 136, 0.34);
    background: rgba(255, 255, 255, 0.075);
  }
}
