:root {
  --background: #f7f7f5;
  --surface: #ffffff;
  --text: #20211f;
  --muted: #6c6e69;
  --border: #deded8;
  --accent: #27614c;
  --accent-soft: #edf4f0;
  --font: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", YuGothic, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background: var(--background);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
}

button {
  font: inherit;
}

input {
  font: inherit;
}

:focus-visible {
  outline: 3px solid rgb(39 97 76 / 28%);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  z-index: 10;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.5rem 0.75rem;
  color: var(--surface);
  background: var(--text);
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.site-header a {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.site-header span {
  color: var(--muted);
  font-size: 0.875rem;
}

main {
  width: min(760px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 64px;
}

.intro {
  margin-bottom: 32px;
}

.intro h1 {
  margin: 0 0 12px;
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.35;
}

.intro > p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
}

.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  margin: 24px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--border);
}

.summary div {
  display: flex;
  gap: 10px;
}

.summary dt,
.summary dd {
  margin: 0;
  font-size: 0.875rem;
}

.summary dt {
  color: var(--muted);
}

.summary dd {
  font-weight: 600;
}

.call-mock {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.call-status {
  display: flex;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8125rem;
}

.call-body {
  padding: clamp(24px, 6vw, 40px);
}

.call-body h2 {
  margin: 0 0 12px;
  font-size: clamp(1.375rem, 4vw, 1.75rem);
  font-weight: 600;
  line-height: 1.4;
}

.question-text {
  min-height: 6.8em;
  margin: 0;
  line-height: 1.9;
}

.playback-state {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 44px;
  margin: 20px 0;
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--muted);
  background: var(--background);
  font-size: 0.875rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #a3a59f;
}

.playback-state.is-active .status-dot {
  background: var(--accent);
}

.answer-options {
  margin: 20px 0;
}

.response-guide {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.response-guide li {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 42px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.response-guide__digit {
  min-width: 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
}

.number-keypad {
  display: grid;
  grid-template-columns: repeat(3, 68px);
  gap: 12px 16px;
  justify-content: center;
  margin-top: 24px;
}

.keypad-button {
  display: grid;
  width: 68px;
  height: 68px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--text);
  background: #e9eae6;
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background-color 120ms ease, transform 120ms ease;
}

.keypad-button:hover:not(:disabled) {
  background: #dcded8;
}

.keypad-button:active:not(:disabled) {
  background: var(--accent-soft);
  transform: scale(0.96);
}

.keypad-button:disabled {
  color: #b6b8b2;
  background: #f2f2ef;
  cursor: default;
}

.call-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.button {
  min-height: 44px;
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}

.button--primary {
  border-color: var(--text);
  color: var(--surface);
  background: var(--text);
}

.button--primary:hover {
  background: #343632;
}

.button--secondary {
  color: var(--text);
  background: var(--surface);
}

.button--secondary:hover {
  background: var(--background);
}

.response-panel,
.cost-panel {
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.response-panel h2,
.cost-panel h2,
.note h2 {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 600;
}

.cost-panel > p {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.cost-panel form {
  margin-top: 24px;
}

.cost-panel fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.cost-panel legend {
  margin-bottom: 12px;
  padding: 0;
  font-size: 0.9375rem;
  font-weight: 600;
}

.cost-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 24px;
}

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

.cost-field label {
  font-size: 0.875rem;
  font-weight: 600;
}

.cost-field small,
.cost-results small {
  color: var(--muted);
  font-size: 0.75rem;
}

.cost-field input {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  background: var(--surface);
}

.cost-field input[aria-invalid="true"] {
  border-color: #a04235;
}

.input-with-unit {
  position: relative;
}

.input-with-unit input {
  padding-right: 42px;
}

.input-with-unit span {
  position: absolute;
  top: 50%;
  right: 12px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.cost-results {
  display: grid;
  grid-template-columns: minmax(180px, 0.75fr) minmax(0, 1.75fr);
  gap: 24px;
  margin-top: 28px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.cost-results__primary {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.cost-results__primary > span {
  font-size: 0.875rem;
  font-weight: 600;
}

.cost-results__primary strong {
  margin: 4px 0 2px;
  font-size: clamp(1.5rem, 4vw, 1.875rem);
  font-weight: 600;
  letter-spacing: -0.03em;
}

.cost-results dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
}

.cost-results dl div {
  min-width: 0;
}

.cost-results dt,
.cost-results dd {
  margin: 0;
}

.cost-results dt {
  color: var(--muted);
  font-size: 0.75rem;
}

.cost-results dd {
  margin-top: 2px;
  font-size: 0.9375rem;
  font-weight: 600;
}

#cost-estimate-status {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.cost-panel .cost-basis {
  margin-top: 12px;
  font-size: 0.75rem;
}

#response-log {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

#response-log li {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

#response-log span,
#response-log strong {
  display: block;
}

#response-log span {
  color: var(--muted);
  font-size: 0.8125rem;
}

#response-log strong {
  margin-top: 2px;
  font-size: 0.9375rem;
  font-weight: 600;
}

#response-log .empty-response {
  border-bottom: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.flow-map {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 0.8125rem;
}

.flow-map span.is-current {
  color: var(--text);
  font-weight: 600;
}

.flow-map span.is-complete {
  color: var(--accent);
}

.flow-map span.is-skipped {
  text-decoration: line-through;
  opacity: 0.55;
}

.note {
  margin-top: 40px;
  color: var(--muted);
}

.note p {
  margin: 0;
  font-size: 0.875rem;
}

@media (max-width: 560px) {
  .site-header {
    padding-inline: 16px;
  }

  main {
    padding-top: 32px;
  }

  .question-text {
    min-height: 0;
  }

  .response-guide {
    grid-template-columns: 1fr;
  }

  .cost-fields,
  .cost-results {
    grid-template-columns: 1fr;
  }

  .cost-results dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .call-actions {
    flex-direction: column;
  }
}
