body {
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;
  background: linear-gradient(180deg, #f4f6ff 0%, #f8f9fc 100%);
  color: #1f2937;
}

main {
  max-width: 960px;
  margin: 24px auto;
  padding: 24px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

h1 {
  font-size: 24px;
}

section {
  margin: 16px 0;
}

.page-description {
  margin: 0 0 16px;
  color: #343a40;
}

.highlight-row {
  font-weight: 700;
  font-size: 1.1rem;
}

.highlight-value {
  font-size: 1.2em;
  color: #111;
}

.side-columns,
.result-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.side-panel {
  margin: 0 0 16px;
  padding: 14px;
  border: 2px solid;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.inline-two {
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: 4px;
}

.inline-two label {
  margin: 0;
}

.attacker-panel {
  border-color: #d94848;
  background: #fffbfb;
}

.defender-panel {
  border-color: #1c7ed6;
  background: #fbfbff;
}

label {
  display: block;
  margin: 8px 0;
}

input,
select,
button {
  display: block;
  margin-top: 4px;
  padding: 8px;
  font-size: 14px;
}

input,
select {
  border: 1.5px solid #8a95a5;
  border-radius: 10px;
  background: #ffffff;
  color: #1f2937;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
button:focus-visible {
  outline: none;
  border-color: #2f9e44;
  box-shadow: 0 0 0 3px rgba(47, 158, 68, 0.22);
}

.percent-input-wrap {
  position: relative;
  display: inline-block;
  width: 4.8em;
}

.percent-input-wrap input {
  width: 100%;
  padding-right: 1.4em;
  box-sizing: border-box;
}

.percent-suffix {
  position: absolute;
  right: 0.5em;
  top: 50%;
  transform: translateY(-50%);
  color: #495057;
  pointer-events: none;
}

button {
  cursor: pointer;
  border: 2px solid #495057;
  border-radius: 10px;
  background: #f8f9fa;
  color: #1f2937;
  font-weight: 700;
}

.details-toggle,
.add-attacker {
  width: 100%;
  margin: 12px 0 8px;
  border: none;
  border-radius: 999px;
  background: transparent;
  font-weight: 600;
}

.add-attacker {
  border: 2px solid #111;
  border-style: solid;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.panel-head h2 {
  margin: 0;
}

.header-name-input {
  margin: 0;
  font-size: 14px;
  line-height: 1.2;
}

.attacker-name-input,
.defender-name-input {
  width: 6.6em;
  padding: 6px 8px;
}

.single-input-head {
  justify-content: flex-start;
}

.panel-actions {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 8px;
}

.mini-toggle,
.mini-delete {
  margin: 0;
  padding: 6px 10px;
  border: 2px solid #111;
  border-radius: 999px;
  background: transparent;
  color: #212529;
  font-weight: 700;
}

.mini-toggle {
  border: none;
}

.fill-toggle {
  flex: 1;
}

.mini-delete {
  margin-left: auto;
  border-style: solid;
  background: #ffe3e3;
  border-color: #111;
  color: #a61e4d;
  border-radius: 8px;
  min-width: 32px;
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 20px;
}

.attacker-name-input,
.defender-name-input {
  border: 2px solid #111;
}

.segmented-row {
  margin: 8px 0;
}

.segmented-row > span {
  display: block;
  margin-bottom: 6px;
}

.segmented-control {
  display: inline-flex;
  border: 1.5px solid #b8b8b8;
  border-radius: 16px;
  overflow: hidden;
  background: #d1d1d1;
  padding: 2px;
  gap: 2px;
}

.segmented-control label {
  margin: 0;
}

.segmented-control input {
  display: none;
}

.segmented-control label span {
  display: block;
  padding: 6px 12px;
  cursor: pointer;
  color: #111;
  border-radius: 0;
  border-right: 1px solid #8f8f8f;
}

.segmented-control label:last-child span {
  border-right: none;
}

.segmented-control input:checked + span {
  background: #ffffff;
  color: #111;
  font-weight: 700;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  margin: 0 1px;
}

.vertical-control {
  flex-direction: column;
  border-radius: 12px;
}

.vertical-control label span {
  border-right: none;
  border-bottom: 1px solid #8f8f8f;
}

.vertical-control label:last-child span {
  border-bottom: none;
}

.attr-select.attr-fire { background: #ffc7c7; }
.attr-select.attr-water { background: #70bfff; }
.attr-select.attr-electric { background: #ffef9c; }
.attr-select.attr-earth { background: #ffe8cc; }
.attr-select.attr-wind { background: #ddf7dd; }
.attr-select.attr-ice { background: #dceeff; }
.attr-select.attr-light { background: #ffffff; }
.attr-select.attr-dark { background: #eddcff; }

.attribute-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 12px;
}

.attribute-grid label {
  margin: 0;
}

.error {
  color: #b00020;
  font-weight: 700;
}

@media (max-width: 760px) {
  .side-columns,
  .result-columns {
    grid-template-columns: 1fr;
  }
}

.hidden {
  display: none;
}

.damage-type-group,
.level-radio-group {
  margin: 8px 0 14px;
}

.damage-type-group > span,
.level-radio-group > span {
  display: block;
  margin-bottom: 6px;
}

.damage-type-group label,
.level-radio-group label {
  display: inline-flex;
  align-items: center;
  margin-right: 10px;
  margin-bottom: 8px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  white-space: nowrap;
}

.damage-type-group .segmented-control label,
.level-radio-group .segmented-control label {
  margin: 0;
}

.damage-type-group input[type="radio"],
.level-radio-group input[type="radio"] {
  display: none;
}

#output > section {
  border: 2px solid #343a40;
  border-radius: 12px;
  padding: 14px;
  background: #f8f9fa;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

#output ul {
  list-style: none;
  padding-left: 0;
  margin-left: 0;
}
