.wp-block-ansico-calculator,
.ansico-calculator-wrap {
  display: block;
  width: 100%;
  margin-block: clamp(28px, 5vw, 44px);
}

.wp-block-ansico-calculator:first-child,
.ansico-calculator-wrap:first-child {
  margin-top: 0;
}

.entry-content > .wp-block-ansico-calculator,
.post-content > .wp-block-ansico-calculator,
.wp-block-post-content > .wp-block-ansico-calculator {
  clear: both;
}


.ansico-calculator {
  --ansico-border: #d9dee7;
  --ansico-border-strong: #c8d2e1;
  --ansico-text: #172033;
  --ansico-text-soft: #5c667a;
  --ansico-surface: #ffffff;
  --ansico-surface-soft: #f7f9fc;
  --ansico-primary: #0f62fe;
  --ansico-primary-soft: #edf4ff;
  --ansico-danger: #b42318;
  --ansico-danger-soft: #fff3f2;
  box-sizing: border-box;
  width: 100%;
  max-width: 860px;
  margin: 0;
  align-self: start;
  padding: clamp(16px, 3vw, 28px);
  border: 1px solid var(--ansico-border);
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  box-shadow: 0 10px 30px rgba(17, 24, 39, 0.06);
  color: var(--ansico-text);
}

.ansico-calculator *,
.ansico-calculator *::before,
.ansico-calculator *::after {
  box-sizing: border-box;
}

.ansico-calculator__description {
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid var(--ansico-border);
  border-radius: 14px;
  background: var(--ansico-surface-soft);
  color: var(--ansico-text-soft);
  line-height: 1.6;
}

.ansico-calculator__description p:last-child {
  margin-bottom: 0;
}

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

.ansico-field {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--ansico-border);
  border-radius: 16px;
  background: var(--ansico-surface);
}

.ansico-field--full {
  grid-column: 1 / -1;
}

.ansico-field__label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
  font-weight: 700;
  line-height: 1.35;
}

.ansico-input {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  border: 1px solid var(--ansico-border-strong);
  border-radius: 12px;
  background: #fff;
  color: var(--ansico-text);
  font: inherit;
  line-height: 1.4;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input.ansico-input[type="radio"],
input.ansico-input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  height: 18px;
  margin: 2px 0 0;
  padding: 0;
  border-radius: 999px;
  accent-color: var(--ansico-primary);
}

input.ansico-input[type="checkbox"] {
  border-radius: 6px;
}

.ansico-input:focus {
  outline: none;
  border-color: var(--ansico-primary);
  box-shadow: 0 0 0 4px rgba(15, 98, 254, 0.12);
}

.ansico-input::placeholder {
  color: #8a94a8;
}

select.ansico-input {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #6b7280 50%), linear-gradient(135deg, #6b7280 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 38px;
}

.ansico-radio-group {
  display: grid;
  gap: 10px;
}

.ansico-choice-label,
.ansico-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--ansico-border);
  border-radius: 12px;
  background: #fff;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.ansico-choice-label:has(input:checked),
.ansico-checkbox-label:has(input:checked) {
  border-color: rgba(15, 98, 254, 0.45);
  background: var(--ansico-primary-soft);
  box-shadow: inset 0 0 0 1px rgba(15, 98, 254, 0.08);
}

.ansico-choice-label span,
.ansico-checkbox-label span {
  display: block;
  min-width: 0;
  line-height: 1.45;
}

.ansico-field__help {
  margin-top: 8px;
  color: var(--ansico-text-soft);
  font-size: 0.95rem;
  line-height: 1.5;
}

.ansico-required {
  color: var(--ansico-danger);
}

.ansico-calculator__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.ansico-calculate-button,
.ansico-reset-button {
  appearance: none;
  border: 0;
  border-radius: 12px;
  min-height: 46px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.ansico-calculate-button:hover,
.ansico-reset-button:hover {
  transform: translateY(-1px);
}

.ansico-calculate-button {
  background: var(--ansico-primary);
  color: #fff;
  box-shadow: 0 10px 20px rgba(15, 98, 254, 0.22);
}

.ansico-reset-button {
  background: #edf2f7;
  color: var(--ansico-text);
}

.ansico-calculate-button:focus,
.ansico-reset-button:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(15, 98, 254, 0.15);
}

.ansico-calculator__result {
  margin-top: 20px;
  padding: 18px;
  border: 1px solid #cfe0ff;
  border-radius: 16px;
  background: linear-gradient(180deg, #f7fbff 0%, #eef5ff 100%);
}

.ansico-calculator__result-label {
  margin: 0 0 6px;
  color: #4d5b77;
  font-size: 0.95rem;
  font-weight: 600;
}

.ansico-calculator__result-value {
  font-size: clamp(1.75rem, 4vw, 2.4rem);
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.02em;
  word-break: break-word;
}

.ansico-calculator__result-help {
  margin-top: 10px;
  color: #4d5b77;
  line-height: 1.5;
}

.ansico-calculator__error {
  margin-top: 20px;
  padding: 14px 16px;
  border: 1px solid #f1b7b2;
  border-radius: 14px;
  background: var(--ansico-danger-soft);
  color: var(--ansico-danger);
  line-height: 1.45;
}

@media (max-width: 782px) {
  .ansico-calculator {
    border-radius: 16px;
    padding: 16px;
  }

  .ansico-calculator__fields {
    grid-template-columns: 1fr;
  }

  .ansico-field {
    padding: 14px;
  }

  .ansico-calculator__actions > * {
    flex: 1 1 100%;
  }

  .ansico-calculate-button,
  .ansico-reset-button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .ansico-calculator {
    padding: 14px;
  }

  .ansico-choice-label,
  .ansico-checkbox-label,
  .ansico-field,
  .ansico-calculator__description,
  .ansico-calculator__result,
  .ansico-calculator__error {
    border-radius: 12px;
  }

  .ansico-input {
    min-height: 44px;
    padding: 10px 12px;
  }
}

.ansico-calculator-single {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.ansico-calculator-single__header {
  margin-bottom: 18px;
}

.ansico-calculator-single__title {
  margin: 0;
  align-self: start;
  line-height: 1.15;
}

.ansico-calculator-single__content > :first-child {
  margin-top: 0;
}
