* { box-sizing: border-box; }

:root {
  --text: #222;
  --muted: #777;
  --border: #ddd;
  --panel: #fff;
  --bg: #f7f7f7;
  --accent: #222;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
  line-height: 1.7;
}

.container {
  width: min(1040px, calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.header-inner {
  min-height: 60px;
  display: flex;
  align-items: center;
}

.logo {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

.hero {
  padding: 52px 0 30px;
  text-align: center;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.3;
}

.hero p {
  margin: 0;
  color: var(--muted);
}

.tool {
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.controls {
  display: grid;
  grid-template-columns: 1.4fr .8fr 1.1fr;
  gap: 20px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.field label:not(.check-label) {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

select,
input[type="number"] {
  width: 100%;
  height: 44px;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.unit-input {
  position: relative;
}

.unit-input input {
  padding-right: 52px;
}

.unit-input span {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 13px;
}

.checkbox-field {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-weight: 600;
}

.check-label input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #222;
}

.checkbox-field p {
  margin: 5px 0 0 27px;
  color: var(--muted);
  font-size: 12px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 22px 0;
}

.actions button,
.result-actions button {
  min-height: 42px;
  padding: 8px 18px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.actions button:hover,
.result-actions button:hover {
  background: #f2f2f2;
}

.actions .primary,
.result-actions button {
  border-color: #222;
  background: #222;
  color: #fff;
}

.actions .primary:hover,
.result-actions button:hover {
  opacity: .82;
}

.result-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.result-heading h2 {
  margin: 0;
  font-size: 18px;
}

.result-heading span {
  color: var(--muted);
  font-size: 13px;
}

textarea {
  display: block;
  width: 100%;
  min-height: 300px;
  resize: vertical;
  padding: 16px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fafafa;
  color: #333;
  font: inherit;
  line-height: 1.8;
}

.result-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

#message {
  color: var(--muted);
  font-size: 13px;
}

.info {
  padding: 42px 4px 10px;
}

.info h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.info h2:not(:first-child) {
  margin-top: 32px;
}

.info p {
  margin: 0 0 8px;
}

.info ol {
  margin: 0;
  padding-left: 1.5em;
}

.site-footer {
  margin-top: 52px;
  padding: 24px 0;
  color: var(--muted);
  border-top: 1px solid var(--border);
  font-size: 13px;
}

@media (max-width: 760px) {
  .container {
    width: min(100% - 24px, 1040px);
  }

  .hero {
    padding: 40px 0 24px;
  }

  .tool {
    padding: 20px 16px;
  }

  .controls {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .checkbox-field {
    padding-top: 4px;
  }
}

@media (max-width: 480px) {
  .actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .actions button {
    width: 100%;
  }

  .result-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .result-actions button {
    width: 100%;
  }

  textarea {
    min-height: 260px;
  }
}
