:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-border: #dfe6f3;
  --text: #172033;
  --muted: #667085;
  --primary: #2563eb;
  --primary-soft: #dbeafe;
  --success: #16a34a;
  --warning: #dc2626;
  --heart: #ef4444;
  --heart-empty: #d5d9e2;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.16), transparent 34rem),
    linear-gradient(135deg, #f8fbff 0%, var(--bg) 42%, #eef4ff 100%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.hero {
  width: min(1440px, calc(100% - 32px));
  margin: 28px auto 18px;
  padding: 28px;
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.08;
}

.hero-text {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 17px;
}

.layout {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto 40px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.panel {
  padding: 22px;
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-heading,
.section-title,
.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-heading {
  margin-bottom: 18px;
}

.panel-heading h2,
.section-title h3 {
  margin: 0;
}

.step {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 12px;
  color: white;
  background: var(--primary);
  font-weight: 800;
}

.section-title {
  margin: 22px 0 12px;
}

.section-title span,
.summary-row {
  color: var(--muted);
  font-size: 14px;
}

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

select,
input[type="range"] {
  width: 100%;
}

select {
  height: 42px;
  padding: 0 12px;
  border: 1px solid #cfd8e8;
  border-radius: 12px;
  color: var(--text);
  background: white;
  outline: none;
}

select:focus,
input[type="range"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

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

.info-item {
  padding: 12px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid #e5eaf3;
}

.info-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.info-item strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.stack {
  display: grid;
  gap: 10px;
}

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

.module-list {
  max-height: 360px;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding-right: 4px;
}

.module-card,
.check-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid #e3e9f5;
  border-radius: 14px;
  background: #f8fafc;
}

.module-card {
  justify-content: space-between;
}

.module-card label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 800;
}

.module-card small {
  color: var(--muted);
  white-space: nowrap;
}

.check-card {
  min-height: 42px;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.check-card.full {
  margin-bottom: 18px;
}

.subtle-control {
  margin-bottom: 12px;
  background: white;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.damage-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(92px, 0.62fr);
  gap: 10px;
  margin-top: 18px;
}

.damage-summary .info-item {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.damage-summary .info-item strong {
  color: var(--primary);
}

.damage-summary .pierce-summary {
  background: #fff1f2;
  border-color: #fecdd3;
}

.damage-summary .pierce-summary strong {
  color: #dc2626;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

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

.compact-controls {
  margin-top: 18px;
}

.range-field strong {
  color: var(--primary);
}

input[type="range"] {
  accent-color: var(--primary);
}

.warning {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  color: #991b1b;
  background: #fee2e2;
  border: 1px solid #fecaca;
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.result-panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.94));
}

.damage-card {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 160px;
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  color: var(--text);
  background: #f8fafc;
}

.damage-card span {
  color: var(--muted);
  font-weight: 800;
}

.damage-card strong {
  font-size: clamp(52px, 9vw, 86px);
  line-height: 1;
}

.heart-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 18px 0 8px;
  font-size: 30px;
  line-height: 1;
}

.heart {
  position: relative;
  color: var(--heart-empty);
}

.heart.full,
.heart.half::before {
  color: var(--heart);
}

.heart.half::before {
  content: "♥";
  position: absolute;
  left: 0;
  width: 50%;
  overflow: hidden;
}

.overflow {
  min-height: 24px;
  color: var(--warning);
  font-weight: 800;
}

.breakdown {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto;
  gap: 8px 14px;
  margin: 0;
}

.breakdown dt {
  color: var(--muted);
  font-weight: 700;
}

.breakdown dd {
  margin: 0;
  font-weight: 900;
  text-align: right;
}

.invalid-result {
  opacity: 0.58;
}

@media (max-width: 980px) {
  .hero,
  .layout {
    width: min(100% - 20px, 720px);
  }

  .hero,
  .layout,
  .two-columns {
    grid-template-columns: 1fr;
  }

  .hero {
    display: grid;
  }

  .hero-result {
    min-width: 0;
  }
}

@media (max-width: 560px) {
  .hero,
  .panel {
    padding: 18px;
    border-radius: 20px;
  }

  .info-grid,
  .mod-row,
  .damage-summary {
    grid-template-columns: 1fr;
  }

  .module-card {
    align-items: flex-start;
    flex-direction: column;
  }
}
