* {
  box-sizing: border-box;
}

:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface2: #243447;
  --text: #e7e9ea;
  --text-muted: #8b98a5;
  --accent: #1d9bf0;
  --positive: #00ba7c;
  --negative: #f4212e;
  --radius: 12px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.layout {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

header {
  margin-bottom: 2rem;
  text-align: center;
}

header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--surface2);
}

.card h2 {
  font-size: 1.15rem;
  margin: 0 0 0.75rem;
}

.card h3 {
  font-size: 1rem;
  margin: 1.5rem 0 0.5rem;
}

.hint {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin: 0 0 1rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

label span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

input, select {
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--surface2);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

.actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

button {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
  font-weight: 500;
}

#btn-submit {
  background: var(--accent);
  color: #fff;
}

#btn-submit:hover {
  filter: brightness(1.1);
}

#btn-clear {
  background: var(--surface2);
  color: var(--text);
}

#btn-clear:hover {
  background: #2d3d52;
}

.hidden {
  display: none !important;
}

.result-section .result-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.result-badge {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1.1rem;
}

.result-badge.discharged {
  background: rgba(0, 186, 124, 0.2);
  color: var(--positive);
}

.result-badge.death {
  background: rgba(244, 33, 46, 0.2);
  color: var(--negative);
}

.result-prob {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.result-detail {
  margin-top: 0.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.shap-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--surface2);
}

.shap-chart {
  margin: 1rem 0;
}

.shap-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.shap-row .name {
  flex: 0 0 200px;
  min-width: 0;
  color: var(--text-muted);
}

.shap-row .bar-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.shap-row .bar {
  height: 22px;
  border-radius: 4px;
  min-width: 4px;
}

.shap-row .bar.neg {
  background: var(--positive);
}

.shap-row .bar.pos {
  background: var(--negative);
}

.shap-row .val {
  flex: 0 0 70px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.shap-row .val.neg { color: var(--positive); }
.shap-row .val.pos { color: var(--negative); }

.shap-remarks {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg);
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.6;
}

.shap-remarks ul {
  margin: 0.5rem 0 0 1.25rem;
  padding: 0;
}

.error-section pre {
  margin: 0;
  padding: 1rem;
  background: var(--bg);
  border-radius: 8px;
  color: var(--negative);
  font-size: 0.85rem;
  overflow-x: auto;
}

footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--surface2);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

footer code {
  background: var(--surface2);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}
