:root {
  color-scheme: light;
  --page: #f5f1ea;
  --surface: #fffdf8;
  --surface-alt: #f8faf7;
  --ink: #252321;
  --muted: #6f6a61;
  --line: #d8d0c3;
  --field: #ffffff;
  --teal: #246b64;
  --teal-dark: #174b46;
  --amber: #a6651b;
  --coral: #b9493c;
  --violet: #6f5aa8;
  --green: #427b46;
  --shadow: 0 12px 30px rgb(58 46 29 / 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--page);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.input-panel,
.result-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.result-panel {
  padding: 18px;
}

.panel-heading,
.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.section-title-block {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 1.35rem;
  line-height: 1.2;
}

h2 {
  font-size: 1rem;
  line-height: 1.25;
}

.status,
.meta-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
  text-align: right;
}

.chart-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.top-controls {
  display: flex;
  justify-content: flex-start;
}

.compact-select {
  width: min(170px, 100%);
}

.compact-select select {
  padding: 7px 9px;
  font-size: 0.86rem;
}

.field-group {
  display: grid;
  gap: 12px;
}

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

.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
}

input,
select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  color: var(--ink);
  font-size: 0.94rem;
  line-height: 1.35;
  padding: 10px 11px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgb(36 107 100 / 0.22);
  outline-offset: 2px;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 2px;
}

.primary-button,
.secondary-button,
.tool-button {
  min-height: 42px;
  border-radius: 6px;
  font-weight: 800;
  line-height: 1.2;
}

.primary-button {
  border: 1px solid var(--teal-dark);
  background: var(--teal);
  color: #fff;
}

.secondary-button {
  border: 1px solid var(--line);
  background: #fff7e9;
  color: var(--amber);
}

.tool-button {
  min-height: 36px;
  border: 1px solid var(--line);
  background: #eef6f3;
  color: var(--teal-dark);
  font-size: 0.84rem;
  padding: 8px 10px;
  white-space: nowrap;
}

.tool-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.empty-state {
  display: grid;
  min-height: calc(100vh - 74px);
  place-items: center;
  color: var(--muted);
  font-weight: 700;
}

.result-view {
  display: grid;
  gap: 18px;
}

.wheel-section,
.report-section {
  min-width: 0;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.wheel-section {
  border-top: 0;
  padding-top: 0;
}

.chart-wheel {
  width: min(820px, 100%);
  aspect-ratio: 1;
  margin: 14px auto 0;
}

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

.wheel-bg {
  fill: #fffdf8;
}

.wheel-ring {
  fill: none;
  stroke: #3f3a33;
  stroke-width: 1.6;
}

.zodiac-line {
  stroke: #d8d0c3;
  stroke-width: 1;
}

.house-line {
  stroke: #91887b;
  stroke-width: 1.1;
}

.angle-line {
  stroke: var(--teal);
  stroke-width: 2.2;
}

.zodiac-label,
.house-label,
.planet-label {
  fill: var(--ink);
  dominant-baseline: middle;
  text-anchor: middle;
  paint-order: stroke;
  stroke: #fffdf8;
  stroke-linejoin: round;
}

.zodiac-label {
  font-size: 16px;
  font-weight: 800;
  stroke-width: 5px;
}

.house-label {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 800;
  stroke-width: 4px;
}

.planet-label {
  font-size: 19px;
  font-weight: 900;
  stroke-width: 4px;
}

.aspect-line {
  fill: none;
  stroke-width: 1.2;
  opacity: 0.42;
}

.aspect-conjunction {
  stroke: var(--amber);
}

.aspect-sextile {
  stroke: var(--teal);
}

.aspect-square,
.aspect-opposition {
  stroke: var(--coral);
}

.aspect-trine {
  stroke: var(--green);
}

.aspect-quincunx {
  stroke: var(--violet);
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px 14px;
  margin-top: 12px;
}

.report-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.report-line,
.aspect-line-row,
.stat-line {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.4;
  padding: 9px 10px;
  overflow-wrap: anywhere;
}

.aspect-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.stat-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stat-name {
  color: var(--muted);
  font-weight: 800;
}

.stat-value {
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

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

  .input-panel {
    position: static;
  }

  .empty-state {
    min-height: 260px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 10px;
  }

  .input-panel,
  .result-panel {
    padding: 14px;
  }

  .two-col,
  .three-col,
  .button-row {
    grid-template-columns: 1fr;
  }

  .panel-heading,
  .section-heading {
    align-items: start;
    flex-direction: column;
  }

  .result-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .status,
  .meta-text {
    text-align: left;
  }
}
