:root {
  color-scheme: light;
  --bg: #f6f3ee;
  --surface: #fffdf9;
  --surface-strong: #f2ede3;
  --ink: #211c18;
  --muted: #6f665e;
  --line: #ded3c2;
  --accent: #9f4f36;
  --accent-2: #1f6f78;
  --gold: #b88a35;
  --shadow: 0 18px 50px rgba(43, 32, 22, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(159, 79, 54, 0.08), transparent 34%),
    linear-gradient(225deg, rgba(31, 111, 120, 0.1), transparent 42%),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

.app-shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(360px, 430px) minmax(0, 1fr);
  gap: 24px;
  padding: 24px;
}

.input-panel,
.result-panel {
  background: rgba(255, 253, 249, 0.88);
  border: 1px solid rgba(222, 211, 194, 0.9);
  box-shadow: var(--shadow);
}

.input-panel {
  position: sticky;
  top: 24px;
  align-self: start;
  border-radius: 18px;
  padding: 28px;
}

.result-panel {
  border-radius: 22px;
  padding: 28px;
  min-height: calc(100vh - 48px);
}

.brand-block h1,
.result-header h2 {
  margin: 8px 0 12px;
  font-size: 34px;
  line-height: 1.12;
  letter-spacing: 0;
}

.positioning,
.principle,
.subtitle,
.hint,
.method-note,
.empty-state p {
  color: var(--muted);
  line-height: 1.75;
}

.principle {
  color: var(--accent);
  font-weight: 700;
}

.eyebrow,
.label {
  margin: 0;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.birth-form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffaf2;
  color: var(--ink);
  font: inherit;
  padding: 10px 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(31, 111, 120, 0.16);
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 10px;
  background: var(--ink);
  color: #fffdf9;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 0 18px;
}

button.secondary {
  background: var(--surface-strong);
  color: var(--ink);
  border: 1px solid var(--line);
}

.is-empty {
  display: grid;
  place-items: center;
}

.empty-state {
  width: min(520px, 100%);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 16px;
  padding: 32px;
}

.result-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 22px;
}

.mode-badge {
  flex: 0 0 auto;
  padding: 10px 14px;
  border-radius: 999px;
  background: #173f45;
  color: #f8f3e7;
  font-size: 13px;
  font-weight: 800;
}

.result-actions {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.edit-profile-button {
  min-height: 38px;
  padding: 0 12px;
  font-size: 13px;
}

.result-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 22px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.tab-button {
  min-height: 38px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--ink);
  border-radius: 999px;
  white-space: nowrap;
  padding: 0 14px;
}

.tab-button.is-active {
  background: var(--ink);
  color: #fffdf9;
  border-color: var(--ink);
}

.tab-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

.visual-layout {
  display: grid;
  grid-template-columns: minmax(320px, 480px) minmax(280px, 1fr);
  gap: 20px;
  align-items: stretch;
}

.chart-card,
.summary-card,
.module {
  border: 1px solid var(--line);
  background: rgba(255, 250, 242, 0.75);
  border-radius: 16px;
}

.chart-card {
  padding: 14px;
}

.chart-card svg {
  display: block;
  width: 100%;
  height: auto;
}

.summary-card {
  padding: 22px;
}

.summary-card h3 {
  margin: 8px 0 12px;
  font-size: 24px;
}

.summary-card p {
  color: var(--muted);
  line-height: 1.8;
}

.summary-pair {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 14px;
  color: var(--muted);
}

.summary-pair strong {
  color: var(--ink);
}

.summary-energy {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.module {
  margin-top: 20px;
  padding: 22px;
}

.module-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 18px;
}

.module-heading h3 {
  margin: 0;
  font-size: 22px;
}

.energy-list {
  display: grid;
  gap: 12px;
}

.energy-row {
  display: grid;
  grid-template-columns: 104px minmax(120px, 1fr) 72px;
  gap: 14px;
  align-items: center;
}

.energy-name {
  font-weight: 900;
}

.energy-bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5dac8;
}

.energy-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-2), var(--gold), var(--accent));
}

.energy-score {
  text-align: right;
  font-weight: 900;
}

.energy-text {
  grid-column: 2 / 4;
  margin: -6px 0 4px;
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

.placement-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.placement-list {
  display: grid;
  gap: 10px;
}

.placement-summary-card {
  border-left: 4px solid var(--gold);
  background: rgba(255, 253, 249, 0.72);
  padding: 16px;
  border-radius: 10px;
}

.placement-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.placement-chip-list span {
  border: 1px solid rgba(222, 211, 194, 0.9);
  border-radius: 999px;
  background: #fffaf2;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
  padding: 6px 9px;
}

.placement-summary-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.placement-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 6px 14px;
  align-items: baseline;
  border-bottom: 1px solid rgba(222, 211, 194, 0.72);
  padding: 0 0 12px;
}

.placement-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.placement-row strong {
  font-size: 16px;
}

.placement-row span {
  color: var(--accent);
  font-size: 14px;
  font-weight: 900;
}

.placement-row p {
  grid-column: 2;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.placement-card,
.house-card,
.mansion-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: rgba(255, 253, 249, 0.72);
}

.placement-card h4,
.house-card h4,
.mansion-card h4 {
  margin: 0 0 8px;
  font-size: 17px;
}

.placement-card p,
.house-card p,
.mansion-card p,
.aspect-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.placement-card .texture-meta {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(222, 211, 194, 0.75);
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 800;
}

.house-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

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

.house-card h4,
.mansion-card h4 {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.house-card span,
.mansion-card span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.mansion-card p {
  font-size: 13px;
}

.aspect-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.aspect-card {
  border-left: 4px solid var(--accent-2);
  background: rgba(255, 253, 249, 0.72);
  padding: 14px 16px;
  border-radius: 10px;
}

.aspect-card.pressure {
  border-left-color: var(--accent);
}

.aspect-card strong {
  display: block;
  margin-bottom: 6px;
}

.aspect-summary-card {
  border-left: 4px solid var(--accent-2);
  background: rgba(255, 253, 249, 0.72);
  padding: 16px;
  border-radius: 10px;
}

.aspect-summary-card strong {
  display: block;
  margin-bottom: 8px;
  line-height: 1.55;
}

.aspect-summary-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.health-card {
  border-left: 4px solid var(--accent);
  background: rgba(255, 253, 249, 0.72);
  padding: 16px;
  border-radius: 10px;
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.health-grid div {
  border: 1px solid rgba(222, 211, 194, 0.86);
  border-radius: 10px;
  background: #fffaf2;
  padding: 12px;
}

.health-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 6px;
}

.health-grid strong {
  display: block;
  line-height: 1.55;
}

.health-card p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.75;
}

.health-card .health-safety {
  border-top: 1px solid rgba(222, 211, 194, 0.86);
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  padding-top: 12px;
}

.report {
  display: grid;
  gap: 18px;
}

.report h4 {
  margin: 0 0 -8px;
  color: var(--accent);
  font-size: 18px;
}

.report p {
  margin: 0;
  color: #3a3029;
  line-height: 1.9;
}

.ai-status {
  border: 1px solid rgba(31, 111, 120, 0.22);
  border-radius: 10px;
  background: rgba(31, 111, 120, 0.08);
  padding: 12px 14px;
  color: var(--accent-2);
  font-weight: 800;
}

.method-note {
  margin: 18px 0 0;
  font-size: 13px;
}

.year-hero {
  margin-top: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 20px;
  align-items: stretch;
}

.year-hero h3 {
  margin: 8px 0 12px;
  font-size: 28px;
}

.year-hero p {
  color: var(--muted);
  line-height: 1.8;
}

.year-stats {
  display: grid;
  gap: 12px;
}

.year-stats div,
.transit-field-card,
.key-month-item,
.key-window-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 253, 249, 0.72);
  padding: 16px;
}

.year-stats span,
.key-month-item span,
.key-window-item span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 6px;
}

.year-stats strong {
  display: block;
  font-size: 20px;
}

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

.transit-field-card h4,
.key-month-item h4,
.key-window-item h4 {
  margin: 0 0 8px;
}

.transit-field-card p,
.key-month-item p,
.key-window-item p {
  color: var(--muted);
  line-height: 1.65;
  margin: 0;
}

.transit-field-card.opportunity {
  border-left: 4px solid var(--accent-2);
}

.transit-field-card.pressure {
  border-left: 4px solid var(--accent);
}

.key-month-list,
.key-window-list {
  display: grid;
  gap: 12px;
}

.key-month-item {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 14px;
}

.key-window-item {
  border-left: 4px solid var(--gold);
}

.chart-ring {
  fill: none;
  stroke: #d9cab5;
  stroke-width: 1.5;
}

.chart-house {
  stroke: #dfd0bd;
  stroke-width: 1;
}

.chart-lodge {
  stroke: rgba(159, 79, 54, 0.38);
  stroke-width: 0.8;
}

.chart-label {
  fill: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-anchor: middle;
}

.chart-house-label {
  fill: var(--ink);
  font-size: 7.6px;
  font-weight: 800;
  text-anchor: middle;
}

.chart-house-index {
  fill: var(--accent);
  font-size: 8px;
  font-weight: 900;
  text-anchor: middle;
}

.chart-lodge-label {
  fill: #7c6e60;
  font-size: 7px;
  font-weight: 700;
  text-anchor: middle;
}

.chart-planet {
  fill: #173f45;
}

.chart-planet-text {
  fill: #fffaf2;
  font-size: 11px;
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: central;
}

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

  .input-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  body {
    background: var(--bg);
  }

  .app-shell {
    display: block;
    min-height: 100vh;
    padding: 0;
  }

  .input-panel,
  .result-panel {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 16px;
  }

  .input-panel {
    border-top: 0;
  }

  .result-panel {
    min-height: auto;
    border-bottom: 0;
    margin-top: 10px;
  }

  .has-result .input-panel {
    display: none;
  }

  .has-result .result-panel {
    margin-top: 0;
    min-height: 100vh;
  }

  .brand-block h1,
  .result-header h2 {
    margin: 6px 0 8px;
    font-size: 26px;
    line-height: 1.18;
  }

  .positioning,
  .principle,
  .subtitle,
  .hint,
  .method-note,
  .empty-state p {
    line-height: 1.6;
  }

  .birth-form {
    gap: 12px;
    margin-top: 18px;
  }

  label {
    gap: 6px;
    font-size: 13px;
  }

  input,
  select,
  button {
    min-height: 44px;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  button {
    width: 100%;
  }

  .form-grid,
  .visual-layout,
  .placement-grid,
  .house-grid,
  .mansion-grid,
  .aspect-list {
    grid-template-columns: 1fr;
  }

  .result-header,
  .module-heading,
  .year-hero {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .result-actions {
    justify-items: start;
  }

  .result-header {
    margin-bottom: 14px;
  }

  .mode-badge {
    width: fit-content;
    padding: 8px 12px;
    font-size: 12px;
  }

  .result-tabs {
    position: sticky;
    top: 0;
    z-index: 5;
    margin: 0 -16px 16px;
    padding: 10px 16px;
    background: rgba(246, 243, 238, 0.96);
    border-top: 1px solid rgba(222, 211, 194, 0.7);
    border-bottom: 1px solid rgba(222, 211, 194, 0.7);
    scrollbar-width: none;
  }

  .result-tabs::-webkit-scrollbar {
    display: none;
  }

  .tab-button {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
  }

  .visual-layout {
    gap: 12px;
  }

  .chart-card {
    margin: 0 -8px;
    padding: 8px;
    overflow-x: auto;
    border-radius: 12px;
    scrollbar-width: thin;
  }

  .chart-card svg {
    min-width: 360px;
  }

  .summary-card {
    padding: 16px;
  }

  .summary-card h3 {
    font-size: 21px;
  }

  .summary-energy {
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
  }

  .summary-pair {
    align-items: center;
    gap: 12px;
  }

  .module {
    margin-top: 14px;
    padding: 16px;
    border-radius: 12px;
  }

  .transit-generator {
    position: sticky;
    top: 55px;
    z-index: 4;
    background: rgba(255, 253, 249, 0.96);
  }

  .transit-structure {
    display: none;
  }

  .transit-generate-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .transit-generate-row input {
    width: 100%;
  }

  .year-stats {
    grid-template-columns: 1fr 1fr;
  }

  .year-stats div {
    padding: 12px;
  }

  .year-stats strong {
    font-size: 15px;
    line-height: 1.35;
  }

  .module-heading {
    align-items: start;
    margin-bottom: 12px;
  }

  .module-heading h3 {
    font-size: 20px;
  }

  .transit-field-grid,
  .key-month-item {
    grid-template-columns: 1fr;
  }

  .energy-row {
    grid-template-columns: 58px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 0;
    border-bottom: 0;
  }

  .energy-score {
    min-width: 68px;
    font-size: 13px;
  }

  .energy-text {
    grid-column: 1 / 4;
    margin: -2px 0 0;
    font-size: 13px;
    line-height: 1.55;
  }

  .placement-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .placement-row p {
    grid-column: 1;
    line-height: 1.58;
  }

  .placement-card,
  .house-card,
  .mansion-card {
    padding: 14px;
    border-radius: 10px;
  }

  .placement-card h4,
  .house-card h4,
  .mansion-card h4 {
    font-size: 16px;
  }

  .mansion-card p {
    font-size: 13px;
  }

  .aspect-card {
    padding: 13px 14px;
  }

  .health-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .health-card,
  .aspect-summary-card,
  .placement-summary-card {
    padding: 14px;
  }

  .report {
    gap: 16px;
  }

  .report h4 {
    font-size: 17px;
  }

  .report p {
    line-height: 1.78;
  }

  .year-hero h3 {
    font-size: 22px;
  }

.key-month-item {
    gap: 8px;
  }
}

.transit-generate-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.transit-generate-row input {
  width: min(220px, 100%);
}

.transit-generate-row button:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

@media (max-width: 390px) {
  .input-panel,
  .result-panel {
    padding: 14px;
  }

  .result-tabs {
    margin-inline: -14px;
    padding-inline: 14px;
  }

  .chart-card {
    margin-inline: -6px;
  }

  .chart-card svg {
    min-width: 350px;
  }
}
