* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Euclid Circular A", "Segoe UI", Tahoma, sans-serif;
}

html {
  background: var(--tool-bg);
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  background: var(--tool-bg);
  color: var(--tool-text);
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

input,
select,
textarea {
  caret-color: var(--tool-text);
  cursor: var(--tool-input-cursor);
}

html.dark-mode select option {
  background: var(--tool-surface);
  color: var(--tool-text);
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--tool-focus);
  outline-offset: 2px;
}

.tool-page {
  padding-top: 64px;
}

.tool-shell {
  width: min(1060px, calc(100% - 32px));
  margin: 0 auto;
}

.page-header {
  padding: 40px 0 24px;
  border-bottom: 1px solid var(--tool-line);
  background: var(--tool-surface);
}

.page-header h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.1;
  letter-spacing: 0;
}

.page-header p:not(.section-label) {
  max-width: 720px;
  margin: 14px 0 0;
  color: var(--tool-muted);
  font-size: 16px;
  line-height: 1.7;
}

.section-label {
  display: inline-block;
  margin: 0 0 10px;
  color: var(--tool-accent-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.wizard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
  padding: 22px 0 52px;
}

.wizard-main,
.summary-panel,
.wizard-panel,
.report-card,
.content-section article {
  border: 1px solid var(--tool-line);
  border-radius: var(--tool-radius);
  background: var(--tool-surface);
  box-shadow: var(--tool-shadow);
}

.wizard-main {
  overflow: hidden;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--tool-line);
  background: var(--tool-panel);
}

.step {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 54px;
  border: 0;
  border-right: 1px solid var(--tool-line);
  background: transparent;
  color: var(--tool-muted);
  font-size: 14px;
  font-weight: 750;
}

.step:last-child {
  border-right: 0;
}

.step span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--tool-line);
  border-radius: 50%;
  background: var(--tool-surface);
  color: var(--tool-muted);
  font-size: 12px;
}

.step.active {
  color: var(--tool-text);
  background: var(--tool-surface);
}

.step.active span {
  border-color: var(--tool-accent);
  background: var(--tool-accent);
  color: #ffffff;
}

.wizard-panel {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 22px;
  min-width: 0;
  overflow: hidden;
}

.wizard-panel.hidden {
  display: none;
}

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

.panel-heading h2,
.summary-panel h2,
.content-section h2 {
  margin: 0;
  color: var(--tool-text);
  font-size: 22px;
  line-height: 1.25;
}

.panel-heading p:not(.section-label),
.summary-note,
.field-help,
.notice,
.content-section p,
.content-section li {
  color: var(--tool-muted);
  font-size: 14px;
  line-height: 1.68;
}

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

.choice-card {
  min-height: 126px;
  padding: 18px;
  border: 1px solid var(--tool-line);
  border-radius: var(--tool-radius);
  background: var(--tool-surface);
  color: var(--tool-text);
  text-align: left;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}

.choice-card:hover,
.choice-card.selected {
  border-color: var(--tool-accent);
  background: var(--tool-panel);
}

.choice-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 17px;
  line-height: 1.3;
}

.choice-card span {
  color: var(--tool-muted);
  font-size: 14px;
  line-height: 1.5;
}

.secondary-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--tool-line);
}

.plain-option,
.secondary-action,
.primary-action,
.row-action {
  min-height: 42px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 760;
}

.plain-option,
.secondary-action,
.row-action {
  border: 1px solid var(--tool-line);
  background: var(--tool-surface);
  color: var(--tool-text);
}

.primary-action {
  border: 1px solid var(--tool-accent);
  background: var(--tool-accent);
  color: #ffffff;
  padding: 0 18px;
}

.primary-action:hover {
  background: var(--tool-accent-dark);
}

.secondary-action,
.plain-option {
  padding: 0 14px;
}

.panel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.panel-actions.between {
  justify-content: space-between;
  align-items: center;
}

.panel-actions.between > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.notice {
  margin: 0 0 14px;
  padding: 12px;
  border-left: 3px solid var(--tool-accent);
  background: var(--tool-panel);
}

.mode-section {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.mode-section + .settings-box {
  margin-top: 18px;
}

.input-mode-box {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--tool-line);
  border-radius: var(--tool-radius);
  background: var(--tool-panel);
}

.input-mode-box label {
  color: var(--tool-text);
  font-size: 14px;
  font-weight: 800;
}

.input-mode-box select {
  width: min(100%, 360px);
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid var(--tool-line);
  border-radius: 6px;
  background: var(--tool-surface);
  color: var(--tool-text);
  caret-color: var(--tool-text);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.table-bottom-action {
  display: flex;
  justify-content: flex-start;
  padding-top: 2px;
}

.row-action {
  min-height: 36px;
  padding: 0 11px;
  font-size: 13px;
}

.add-row-action {
  min-width: 170px;
  border-color: var(--tool-accent);
  color: var(--tool-accent-dark);
  background: var(--tool-surface);
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--tool-line);
  border-radius: var(--tool-radius);
}

.input-table {
  width: 100%;
  min-width: 650px;
  border-collapse: collapse;
}

.input-table th,
.input-table td {
  padding: 10px;
  border-bottom: 1px solid var(--tool-line);
  text-align: left;
  vertical-align: top;
}

.input-table th {
  background: var(--tool-panel);
  color: var(--tool-muted);
  font-size: 12px;
  font-weight: 800;
}

.input-table tr:last-child td {
  border-bottom: 0;
}

.field,
.field-inline {
  display: grid;
  gap: 6px;
}

.field label,
.field-inline label {
  color: var(--tool-text);
  font-size: 13px;
  font-weight: 760;
}

.field input,
.field select,
.field-inline input,
.field-inline select,
.cell-input {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid var(--tool-line);
  border-radius: 6px;
  background: var(--tool-surface);
  color: var(--tool-text);
}

.cell-input.error,
.field input.error,
.field select.error {
  border-color: var(--tool-danger);
}

.error-text {
  display: block;
  min-height: 17px;
  margin-top: 4px;
  color: var(--tool-danger);
  font-size: 12px;
  line-height: 1.35;
}

.settings-box {
  border: 1px solid var(--tool-line);
  border-radius: var(--tool-radius);
  background: var(--tool-panel);
}

.settings-box summary {
  padding: 14px;
  color: var(--tool-text);
  font-weight: 800;
  cursor: pointer;
}

.settings-content {
  padding: 0 14px 14px;
}

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

.range-grid {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--tool-line);
  border-radius: 6px;
  background: var(--tool-surface);
}

.range-header {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
  padding: 9px 12px;
  border: 1px solid var(--tool-line);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: var(--tool-surface);
  color: var(--tool-muted);
  font-size: 12px;
  font-weight: 800;
}

.range-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--tool-line);
}

.range-row:last-child {
  border-bottom: 0;
}

.range-row label {
  display: grid;
  gap: 5px;
}

.range-row label span {
  display: none;
  color: var(--tool-muted);
  font-size: 12px;
  font-weight: 800;
}

.range-row input {
  min-height: 36px;
  padding: 8px 9px;
  border: 1px solid var(--tool-line);
  border-radius: 5px;
  background: var(--tool-panel);
  color: var(--tool-text);
}

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

.summary-panel {
  position: sticky;
  top: 88px;
  padding: 18px;
}

.summary-value {
  margin: 18px 0;
  padding: 15px 0;
  border-top: 1px solid var(--tool-line);
  border-bottom: 1px solid var(--tool-line);
}

.summary-value span {
  display: block;
  color: var(--tool-muted);
  font-size: 13px;
  font-weight: 750;
}

.summary-value strong {
  display: block;
  margin-top: 5px;
  color: var(--tool-text);
  font-size: 40px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.summary-panel dl {
  display: grid;
  gap: 9px;
  margin: 0;
}

.summary-panel div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--tool-muted);
  font-size: 13px;
}

.summary-panel dt,
.summary-panel dd {
  margin: 0;
}

.summary-panel dd {
  color: var(--tool-text);
  font-weight: 800;
}

.report-card {
  padding: 18px;
}

.report-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--tool-line);
}

.report-head h3 {
  margin: 0;
  font-size: 20px;
}

.report-score {
  text-align: right;
}

.report-score span {
  display: block;
  color: var(--tool-muted);
  font-size: 12px;
  font-weight: 760;
}

.report-score strong {
  display: block;
  margin-top: 3px;
  font-size: 32px;
  font-variant-numeric: tabular-nums;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.metric {
  padding: 12px;
  border: 1px solid var(--tool-line);
  border-radius: 6px;
  background: var(--tool-panel);
}

.metric span {
  display: block;
  color: var(--tool-muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 5px;
  color: var(--tool-text);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.mini-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  table-layout: fixed;
  margin-top: 10px;
}

.mini-table th,
.mini-table td {
  padding: 8px;
  border: 1px solid var(--tool-line);
  font-size: 12px;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.mini-table th {
  background: var(--tool-panel);
  color: var(--tool-muted);
}

.formula-note {
  margin: 12px 0 0;
  color: var(--tool-muted);
  font-size: 13px;
  line-height: 1.6;
}

.status-success {
  color: var(--tool-success) !important;
}

.status-warning {
  color: var(--tool-warning) !important;
}

.status-danger {
  color: var(--tool-danger) !important;
}

.content-section {
  display: block;
  padding: 0 0 64px;
}

.content-section article {
  display: grid;
  grid-template-columns: 245px minmax(0, 1fr);
  gap: 26px;
  padding: 26px 0;
  border: 0;
  border-top: 1px solid var(--tool-line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.content-section h2 {
  margin: 0;
  max-width: 220px;
}

.content-section h3 {
  margin: 18px 0 6px;
  font-size: 16px;
}

.content-section p {
  margin: 0 0 12px;
}

.content-section ul {
  margin: 0;
  padding-left: 20px;
}

.content-section article > *:not(h2) {
  grid-column: 2;
}

.content-section article h2 + p,
.content-section article h2 + ul,
.content-section article h2 + h3 {
  margin-top: 0;
}

.use-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.use-steps li {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--tool-line);
  border-radius: 6px;
  background: var(--tool-surface);
}

.use-steps span {
  display: inline-grid;
  width: 28px;
  height: 28px;
  margin-bottom: 12px;
  place-items: center;
  border: 1px solid var(--tool-line);
  border-radius: 50%;
  color: var(--tool-accent-dark);
  font-size: 13px;
  font-weight: 900;
}

.use-steps strong {
  display: block;
  margin-bottom: 6px;
  color: var(--tool-text);
  font-size: 14px;
}

.use-steps p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 1100px) {
  .content-section article.use-guide {
    display: block;
  }

  .content-section article.use-guide h2 {
    max-width: none;
    margin-bottom: 14px;
  }
}

@media (max-width: 900px) {
  .use-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.comparison-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--tool-line);
  border-radius: 8px;
}

.comparison-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  background: var(--tool-surface);
}

.comparison-table th,
.comparison-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--tool-line);
  text-align: left;
  vertical-align: top;
}

.comparison-table th {
  background: var(--tool-panel);
  color: var(--tool-text);
  font-size: 13px;
  font-weight: 900;
}

.comparison-table td:first-child {
  color: var(--tool-text);
  font-weight: 800;
}

.comparison-table tr:last-child td {
  border-bottom: 0;
}

.faq-list {
  display: grid;
  gap: 10px;
}

.faq-list details {
  border: 1px solid var(--tool-line);
  border-radius: 6px;
  background: var(--tool-surface);
}

.faq-list summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 14px;
  color: var(--tool-text);
  cursor: pointer;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
  list-style: none;
}

.faq-list summary::-webkit-details-marker {
  display: none;
}

.faq-list summary::after {
  content: "+";
  flex: 0 0 auto;
  color: var(--tool-accent-dark);
  font-size: 18px;
  line-height: 1;
}

.faq-list details[open] summary::after {
  content: "-";
}

.faq-list p {
  margin: 0;
  padding: 0 14px 14px;
  line-height: 1.55;
}

@media (max-width: 980px) {
  .wizard-layout,
  .content-section {
    grid-template-columns: 1fr;
  }

  .summary-panel {
    position: static;
  }
}

@media (max-width: 680px) {
  .tool-page {
    padding-top: 64px;
  }

  .tool-shell {
    width: min(100% - 24px, 1060px);
  }

  .page-header {
    padding-top: 30px;
  }

  .page-header p:not(.section-label),
  .panel-heading p:not(.section-label),
  .content-section p,
  .content-section li {
    font-size: 14px;
  }

  .steps {
    grid-template-columns: 1fr;
  }

  .step {
    justify-content: flex-start;
    padding: 0 16px;
    border-right: 0;
    border-bottom: 1px solid var(--tool-line);
  }

  .choice-grid,
  .form-grid,
  .metric-grid,
  .scale-grid {
    grid-template-columns: 1fr;
  }

  .wizard-panel {
    padding: 16px;
  }

  .panel-actions,
  .panel-actions.between {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-actions.between > div,
  .primary-action,
  .secondary-action {
    width: 100%;
  }

  .panel-actions.between > div {
    flex-direction: column;
  }

  .range-row {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
  }

  .table-wrap {
    overflow: visible;
  }

  .input-table,
  .input-table tbody,
  .input-table tr,
  .input-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .input-table thead {
    display: none;
  }

  .input-table tr {
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid var(--tool-line);
    border-radius: 6px;
    background: var(--tool-panel);
  }

  .input-table tr:last-child {
    margin-bottom: 0;
  }

  .input-table td {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 7px 0;
    border-bottom: 0;
  }

  .input-table td::before {
    content: attr(data-label);
    padding-top: 10px;
    color: var(--tool-muted);
    font-size: 12px;
    font-weight: 800;
  }

  .input-table td[data-label="Actions"] {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .input-table td[data-label="Actions"] .toolbar {
    gap: 8px;
  }

  .input-table td[data-label="Actions"] .row-action {
    flex: 1 1 110px;
  }

  .mini-table {
    min-width: 0;
  }

  .range-header {
    display: none;
  }

  .range-row label span {
    display: block;
  }

  .summary-value strong {
    font-size: 36px;
  }

  .report-head {
    flex-direction: column;
  }

  .report-score {
    text-align: left;
  }

  .content-section article {
    display: block;
    padding: 22px 0;
  }

  .content-section h2 {
    max-width: none;
    margin-bottom: 10px;
  }

  .content-section article > *:not(h2) {
    grid-column: auto;
  }

  .use-steps {
    grid-template-columns: 1fr;
  }

  .use-steps li {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    column-gap: 10px;
    align-items: start;
  }

  .use-steps span {
    grid-row: span 2;
    margin-bottom: 0;
  }
}
