:root {
  --bg: #120817;
  --bg2: #1b1026;
  --panel: rgba(28, 18, 42, 0.78);
  --panel2: rgba(42, 26, 65, 0.88);
  --line: rgba(255,255,255,0.12);
  --text: #f9eefb;
  --muted: #c9b7d9;
  --accent: #ff7ac8;
  --accent2: #a98bff;
  --accent3: #ffd166;
  --good: #83f7c6;
  --bad: #ff8aa0;
  --shadow: 0 20px 70px rgba(0,0,0,0.45);
  --radius: 8px;
}
* { box-sizing: border-box; min-width: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 10%, rgba(255,122,200,0.22), transparent 34%),
    radial-gradient(circle at 85% 15%, rgba(169,139,255,0.22), transparent 30%),
    radial-gradient(circle at 55% 80%, rgba(255,209,102,0.08), transparent 38%),
    linear-gradient(135deg, var(--bg), #09050e 72%);
  color: var(--text);
  overflow-x: hidden;
}
.hidden-control { display: none !important; }
button, input, select, textarea, label, .tab, .hero__badges span, .report-section, td, th {
  max-width: 100%;
  overflow-wrap: anywhere;
}
.stars, .stars:before, .stars:after {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.58) 1px, transparent 1.8px),
    radial-gradient(circle, rgba(255,255,255,0.35) 1px, transparent 1.8px);
  background-size: 120px 120px, 190px 190px;
  background-position: 0 0, 30px 40px;
  opacity: 0.24;
}
.stars:before, .stars:after { content: ""; }
.stars:before { transform: rotate(16deg); opacity: 0.18; }
.stars:after { transform: rotate(-9deg); opacity: 0.12; }
.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 36px;
  align-items: center;
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto;
  padding: 58px 0 26px;
}
.hero h1 {
  font-size: clamp(58px, 8vw, 118px);
  line-height: 0.86;
  margin: 12px 0 0;
  letter-spacing: -0.08em;
  background: linear-gradient(105deg, #fff, #ffd6ef 36%, #bcaaff 70%, #ffe29b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 10px 40px rgba(255, 122, 200, 0.12);
}
.hero h2 {
  margin: 0;
  font-size: clamp(32px, 4vw, 62px);
  letter-spacing: -0.05em;
  color: #fff;
}
.hero p {
  max-width: 760px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.7;
}
.eyebrow {
  color: var(--accent3);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 800;
  font-size: 12px;
}
.hero__badges { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.hero__badges span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 13px;
  background: rgba(255,255,255,0.06);
  color: #f6eafd;
  backdrop-filter: blur(12px);
  font-size: 13px;
}
.hero__orb {
  height: 360px;
  position: relative;
  display: grid;
  place-items: center;
}
.orb-ring, .orb-core { position: absolute; border-radius: 50%; }
.ring1 { width: 320px; height: 320px; border: 1px solid rgba(255,255,255,.18); box-shadow: 0 0 80px rgba(169,139,255,.17); }
.ring2 { width: 250px; height: 250px; border: 1px dashed rgba(255,122,200,.45); transform: rotate(20deg); }
.ring3 { width: 170px; height: 170px; border: 1px solid rgba(255,209,102,.45); transform: rotate(-18deg); }
.orb-core {
  width: 116px; height: 116px;
  display: grid; place-items: center;
  font-size: 50px;
  background: radial-gradient(circle at 35% 28%, #fff, #ffd166 28%, #ff7ac8 56%, #522f88 100%);
  color: #2a1238;
  box-shadow: 0 0 80px rgba(255, 122, 200, .45), inset 0 0 30px rgba(255,255,255,.4);
}
.layout {
  position: relative;
  display: grid;
  grid-template-columns: minmax(420px, 0.86fr) minmax(0, 1.14fr);
  gap: 22px;
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto 34px;
}
.panel {
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.03)), var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  backdrop-filter: blur(18px);
  overflow: hidden;
}
.form-panel { padding: 24px; align-self: start; position: sticky; top: 16px; }
.result-panel { min-height: 760px; }
.panel-title { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.panel-title .icon { font-size: 28px; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 8px; background: rgba(255,122,200,.13); }
h3, p { margin-top: 0; }
.panel-title h3 { margin-bottom: 5px; }
.panel-title p { color: var(--muted); line-height: 1.5; margin-bottom: 0; }
.mode-card, .settings-card, .person-card {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.045);
  border-radius: 8px;
  padding: 16px;
  margin: 0 0 14px;
}
.mode-card p { color: var(--muted); margin: 6px 0 0; font-size: 13px; }
.switch-row { display: flex; gap: 12px; align-items: center; font-weight: 800; }
.switch-row input { width: 20px; height: 20px; accent-color: var(--accent); }
.person-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
legend { color: #fff; font-weight: 900; padding: 0 8px; }
label { display: grid; gap: 7px; color: #f5e9ff; font-weight: 700; font-size: 13px; margin-bottom: 12px; }
input, select {
  width: 100%;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(6, 4, 12, .52);
  color: var(--text);
  border-radius: 8px;
  padding: 12px 13px;
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
input:focus, select:focus {
  border-color: rgba(255,122,200,.75);
  box-shadow: 0 0 0 4px rgba(255,122,200,.12);
  background: rgba(6,4,12,.74);
}
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.quick-city { display: flex; flex-wrap: wrap; gap: 7px; margin: -2px 0 12px; }
.quick-city button {
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: var(--muted);
  border-radius: 8px;
  padding: 6px 9px;
  cursor: pointer;
  font-size: 12px;
}
.quick-city button:hover { color: #fff; border-color: rgba(255,122,200,.5); }
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-top: 16px; }
button {
  font: inherit;
  border: 0;
  cursor: pointer;
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text);
  font-weight: 900;
}
.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #16091f;
  box-shadow: 0 12px 34px rgba(255,122,200,.28);
}
.secondary { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); }
.danger { background: rgba(255,80,120,.14); color: #ffdce5; border: 1px solid rgba(255,80,120,.32); }
button:hover { transform: translateY(-1px); filter: brightness(1.04); }
.tabs {
  display: flex;
  gap: 8px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(0,0,0,.18);
  position: sticky;
  top: 0;
  z-index: 5;
}
.tab { flex: 1; background: rgba(255,255,255,.06); color: var(--muted); }
.tab.active { background: linear-gradient(135deg, rgba(255,122,200,.28), rgba(169,139,255,.22)); color: #fff; }
.status {
  margin: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255,255,255,.055);
  border: 1px solid var(--line);
}
.status.loading { color: var(--accent3); }
.status.ok { color: var(--good); }
.status.error { color: var(--bad); }
.tab-pane { display: none; padding: 0 18px 18px; }
.tab-pane.active { display: block; }
.report {
  font-size: 15.5px;
  line-height: 1.75;
  color: #f4eaff;
}
.report.empty { color: var(--muted); padding: 28px; }
.report-section {
  border: 1px solid rgba(255,255,255,.11);
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.035));
  border-radius: 8px;
  padding: 22px;
  margin: 16px 0;
}
.report-section h2 {
  margin: 0 0 14px;
  font-size: 24px;
  letter-spacing: -0.03em;
  color: #fff;
}
.report-section h3 {
  margin: 20px 0 8px;
  color: #ffd6ef;
}
.report-section p { color: #f1e6fb; }
.report-section strong { color: #fff; }
.report-section ul { padding-left: 20px; }
.report-section li { margin: 7px 0; }
.chart-grid { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 16px; }
.chart-card, .table-wrap, .score-card, .aspect-card {
  border: 1px solid rgba(255,255,255,.11);
  background: rgba(255,255,255,.045);
  border-radius: 8px;
  padding: 18px;
}
.chart-host { min-height: 540px; display: grid; place-items: center; overflow: auto; }
.astro-svg { width: min(100%, 620px); height: auto; overflow: visible; }
.astro-svg text { font-family: "Segoe UI Symbol", "Arial Unicode MS", Inter, sans-serif; }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 9px; border-bottom: 1px solid rgba(255,255,255,.1); text-align: left; vertical-align: top; }
th { color: #fff; background: rgba(255,255,255,.06); position: sticky; top: 0; }
td { color: #ebddf5; }
.score-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-top: 16px; }
.score-card h4 { margin: 0 0 8px; }
.meter { height: 12px; background: rgba(255,255,255,.08); border-radius: 8px; overflow: hidden; border: 1px solid rgba(255,255,255,.08); }
.meter span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent3)); border-radius: 8px; }
.aspect-list { display: grid; gap: 10px; margin-top: 14px; }
.aspect-card { padding: 14px; }
.aspect-card .meta { color: var(--muted); font-size: 12px; margin-top: 5px; }
.saved-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.saved-item { display: grid; gap: 6px; border: 1px solid rgba(255,255,255,.11); border-radius: 8px; padding: 14px; margin: 12px 0; background: rgba(255,255,255,.045); }
.saved-item small { color: var(--muted); }
.saved-item button { justify-self: start; padding: 8px 11px; border-radius: 12px; background: rgba(255,255,255,.08); }
.footer {
  position: relative;
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto 40px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  background: rgba(255,255,255,.045);
}
code { color: #ffd6ef; background: rgba(255,255,255,.08); padding: 2px 6px; border-radius: 7px; }
@media (min-width: 1100px) {
  .chart-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1180px) {
  .hero { grid-template-columns: 1fr; }
  .hero__orb { display: none; }
  .layout { grid-template-columns: 1fr; }
  .form-panel { position: static; }
}
@media (max-width: 760px) {
  .hero, .layout, .footer { width: min(100% - 22px, 1480px); }
  .hero { padding-top: 32px; }
  .form-panel { padding: 16px; }
  .two-col, .three-col, .actions { grid-template-columns: 1fr; }
  .tabs { overflow-x: auto; }
  .tab { white-space: nowrap; }
  .tab-pane { padding: 0 12px 12px; }
  .chart-host { min-height: 400px; }
}
@media print {
  body { background: #fff; color: #111; }
  .hero, .form-panel, .tabs, .status, .footer, .chart-card, .table-wrap, .score-output, .aspect-output { display: none !important; }
  .layout { display: block; width: 100%; margin: 0; }
  .panel { box-shadow: none; border: 0; background: #fff; }
  .tab-pane { display: block !important; padding: 0; }
  .tab-pane:not(#tab-report) { display: none !important; }
  .report-section { color: #111; border: 1px solid #ddd; background: #fff; page-break-inside: avoid; }
  .report-section h2, .report-section h3, .report-section strong { color: #111; }
}

/* Advanced relationship controls */
.advanced-row { margin-top: 14px; }
.match-card textarea {
  width: 100%;
  min-height: 128px;
  resize: vertical;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(8,5,18,.62);
  color: var(--text);
  padding: 13px 14px;
  font-family: inherit;
  line-height: 1.45;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.03);
}
.match-card .hint { color: var(--muted); font-size: .92rem; line-height: 1.5; margin-top: 0; }
.wide { width: 100%; margin-top: 12px; }
.report-section h3 { margin-top: 1.2rem; }
.score-card:nth-last-child(-n+2) .meter span { filter: saturate(.75); }
.table-scroll table td:nth-child(8), .table-scroll table td:nth-child(9) { font-weight: 700; }

/* Practical relationship layer */
.psych-card {
  border-color: rgba(131,247,198,.24);
  background: linear-gradient(180deg, rgba(131,247,198,.075), rgba(255,255,255,.045));
}
.slider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.slider-grid label {
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.045);
  border-radius: 16px;
  padding: 11px 12px;
  color: var(--muted);
}
.slider-grid input[type="range"] {
  width: 100%;
  accent-color: #ff7ac8;
  margin-top: 8px;
}
.psych-card textarea {
  width: 100%;
  resize: vertical;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(8,5,18,.62);
  color: var(--text);
  padding: 13px 14px;
  font-family: inherit;
  line-height: 1.45;
}
.report-section:first-child {
  border-color: rgba(255,214,239,.32);
  background: linear-gradient(180deg, rgba(255,122,200,.12), rgba(255,255,255,.045));
}
.table-scroll table th:nth-child(3), .table-scroll table td:nth-child(3) {
  color: #83f7c6;
}
@media print {
  .psych-card { display: none !important; }
}

/* Profile storage and city controls */
.production-card {
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
  background: linear-gradient(135deg, rgba(255,255,255,.075), rgba(255,122,200,.07));
  box-shadow: 0 18px 45px rgba(0,0,0,.18);
}
.production-card p { margin: 6px 0 0; color: rgba(255,255,255,.72); }
.login-row, .city-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
}
.login-row input { max-width: 150px; }
.mini-btn {
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  padding: 8px 11px;
  color: #fff;
  background: rgba(255,255,255,.08);
  cursor: pointer;
}
.mini-check { display: inline-flex; gap: 6px; align-items: center; font-size: .88rem; color: rgba(255,255,255,.74); }
.server-profile-list { margin-top: 10px; display: grid; gap: 8px; }
.server-profile-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(255,255,255,.1);
  padding: 9px 11px;
  border-radius: 8px;
  background: rgba(0,0,0,.18);
}
.server-profile-item small { display: block; color: rgba(255,255,255,.56); font-size: .75rem; }
.qa-output { margin-top: 15px; }
.error-text { color: #ff8aa0; font-weight: 800; }
@media (max-width: 760px) {
  .hero { padding: 28px 16px 18px; }
  .hero__text h1 { font-size: clamp(2.4rem, 15vw, 4rem); }
  .hero__orb { display: none; }
  .layout { display: block; padding: 0; width: min(100% - 18px, 1480px); }
  .panel { border-radius: 18px; padding: 14px; margin-bottom: 12px; }
  .person-grid, .two-col, .three-col { grid-template-columns: 1fr !important; }
  .actions { grid-template-columns: 1fr 1fr; }
  .actions .primary { grid-column: 1 / -1; }
  .login-row, .city-actions { flex-direction: column; align-items: stretch; }
  .actions button, .login-row button, .login-row input, .city-actions button { width: 100%; max-width: none; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .tab { white-space: nowrap; }
  .astro-svg { min-width: 330px; }
  .chart-host { overflow-x: auto; }
  input, select, textarea, button { font-size: 16px; }
  .panel { border-radius: 8px; }
  .tabs { gap: 6px; }
  .tab { flex: 0 0 auto; padding: 10px 12px; }
  .report-section { padding: 15px; }
  .report-section h2 { font-size: 20px; }
}
@media print {
  .form-panel, .tabs, .actions, .footer, .status, .stars { display: none !important; }
  .layout { display: block; }
  .result-panel { box-shadow: none; border: 0; }
  body { background: #fff; color: #111; }
  .report-section { break-inside: avoid; color: #111; background: #fff; border-color: #ddd; }
}

@media (max-width: 760px) {
  .tabs {
    flex-wrap: wrap;
    overflow: visible;
  }
  .tab {
    flex: 1 1 calc(50% - 8px);
    white-space: normal;
    min-height: 44px;
  }
}
