:root {
  --bg: #161820;
  --card: rgba(255, 255, 255, 0.06);
  --card-border: rgba(255, 255, 255, 0.16);
  --accent: #0b0920;
  --accent-light: rgba(89, 86, 148, 0.55);
  --text-main: rgba(255, 255, 255, 0.92);
  --text-muted: rgba(255, 255, 255, 0.70);
  --grid-line: rgba(255, 255, 255, 0.16);
  --ui-surface: rgba(255, 255, 255, 0.07);
  --ui-surface-2: rgba(255, 255, 255, 0.10);
  --ui-border: rgba(255, 255, 255, 0.18);
  --ui-hover: rgba(255, 255, 255, 0.14);
}

* {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Helvetica Neue", Arial, sans-serif;
}

body {
  margin: 0;
  padding: 24px;
  min-height: 100vh; 
  background: radial-gradient(
    circle at top left,
    color-mix(in srgb, var(--bg), #ffffff 8%),
    var(--bg) 50%
  ) fixed;
  color: var(--text-main);
  overflow-x: hidden;
}

h1 {
  font-weight: 500;
  font-size: 1.6rem;
  margin-bottom: 4px;
  text-align: center;
}

p.description {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 640px;
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

.layout {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 260px minmax(0, 2.2fr) 320px;
  gap: 24px;
  align-items: start;
}

.card {
  background: var(--card);
  border-radius: 16px;
  padding: 16px 18px 18px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.25), 0 0 0 1px var(--card-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.panel-title {
  font-weight: 650;
  font-size: 1.05rem;
  color: var(--text-main);
  margin: 0 0 10px;
}

.burden-panel {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.burden-panel strong { color: var(--text-main); }

.burden-panel ul {
  padding-left: 18px;
  margin-top: 0;
  margin-bottom: 10px;
}

.legend-code {
  font-family: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.80);
  border-radius: 8px;
  padding: 6px 8px;
  display: inline-block;
  margin-top: 4px;
  margin-left: -12px;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 8px;
}

label {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.condition-row { display: flex; flex-direction: column; gap: 4px; }
.condition-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.condition-chip {
  border-radius: 999px;
  border: 1px solid var(--ui-border);
  background: var(--ui-surface);
  padding: 4px 10px;
  font-size: 0.8rem;
  color: var(--text-main);
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    box-shadow 0.15s ease;
}
.condition-chip:hover { background: var(--ui-hover); }
.condition-chip.active {
  background: var(--accent-light);
  border-color: rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.10);
}

.med-row { display: flex; flex-direction: column; gap: 4px; }
.med-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.med-dropdown { position: relative; max-width: 280px; }

.med-dropdown-toggle {
  width: 100%;
  border-radius: 999px;
  border: 1px solid var(--ui-border);
  background: var(--ui-surface);
  padding: 6px 12px;
  font-size: 0.85rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.med-dropdown-toggle:hover {
  background: var(--ui-hover);
  border-color: rgba(255, 255, 255, 0.24);
}
.med-dropdown-toggle.open {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.26);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.10);
}
.med-dropdown-toggle .chevron { font-size: 0.7rem; opacity: 0.75; }

.med-dropdown-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  display: none;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(10, 12, 18, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 18px 35px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.10);
  max-height: 260px;
  overflow-y: auto;
  font-size: 0.85rem;
  z-index: 20;
}
.med-dropdown-panel.open { display: block; }

#medication-checkboxes { margin: 0; padding: 0; }

#medication-checkboxes label {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 4px 4px;
  margin: 0;
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
  color: rgba(255, 255, 255, 0.88);
}
#medication-checkboxes label:hover {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}
#medication-checkboxes input[type="checkbox"] {
  margin-top: 2px;
  accent-color: rgba(255, 255, 255, 0.85);
}

#chart-container {
  width: 100%;
  height: 520px;
  position: relative;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 14px;
  overflow: visible;
}

svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.axis line { stroke: var(--grid-line); stroke-width: 1; }
.axis-label { font-size: 0.75rem; fill: var(--text-muted); text-anchor: middle; }
.grid-circle { fill: none; stroke: var(--grid-line); stroke-width: 0.8; }

.radar-area { stroke-width: 2; cursor: pointer; }
.radar-point { fill: rgba(255, 255, 255, 0.95); stroke-width: 1.5; cursor: pointer; }

.radar-aggregate { pointer-events: none; }

.details-panel .info-panel { margin-top: 4px; }

.info-body {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 10px 12px;
  color: var(--text-main);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.info-empty { color: var(--text-muted); font-size: 0.9rem; line-height: 1.4; }
.info-med-name { font-weight: 650; font-size: 1rem; margin-bottom: 2px; }
.info-med-meta { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 8px; }
.info-med-story { font-size: 0.9rem; line-height: 1.45; margin-bottom: 8px; }

.info-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.info-tag {
  font-size: 0.75rem;
  padding: 3px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: none;
  color: rgba(255, 255, 255, 0.65);
  letter-spacing: 0.02em;
  cursor: default;
  user-select: none;
}

.info-tag.dominant {
  font-weight: 650;
  color: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.info-tag.dom-pills {
  background: rgba(120, 190, 255, 0.16);
  border-color: rgba(120, 190, 255, 0.30);
}
.info-tag.dom-timing {
  background: rgba(180, 140, 255, 0.16);
  border-color: rgba(180, 140, 255, 0.30);
}
.info-tag.dom-food {
  background: rgba(120, 230, 180, 0.16);
  border-color: rgba(120, 230, 180, 0.30);
}
.info-tag.dom-effects {
  background: rgba(255, 140, 170, 0.16);
  border-color: rgba(255, 140, 170, 0.30);
}
.info-tag.dom-monitoring {
  background: rgba(255, 210, 120, 0.16);
  border-color: rgba(255, 210, 120, 0.30);
}

.focus-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.focus-btn {
  appearance: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.88);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 0.86rem;
  line-height: 1.1;
  cursor: pointer;
  box-shadow: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease,
    transform 120ms ease;
}
.focus-btn:hover { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.24); }
.focus-btn.active {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.30);
  color: rgba(255, 255, 255, 0.95);
  font-weight: 650;
}

.info-divider { height: 1px; background: rgba(255, 255, 255, 0.14); margin: 10px 0; }

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; gap: 16px; }
  .med-dropdown { max-width: 100%; }
  .med-dropdown-panel { max-height: 200px; }
}
