:root {
  --bg: #f5f2ec;
  --surface: #ffffff;
  --surface-soft: #f9f7f2;
  --text: #1f2933;
  --muted: #667085;
  --line: #d9dde3;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --accent-soft: #dff5f1;
  --risk: #b42318;
  --risk-soft: #fff0ed;
  --warning: #b7791f;
  --good: #176b43;
  --shadow: 0 18px 55px rgba(31, 41, 51, 0.1);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
  line-height: 1.6;
}

button,
input,
textarea {
  font: inherit;
}

.app-header {
  background: #14302d;
  color: #ffffff;
  padding: 42px 20px 34px;
}

.header-inner {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.eyebrow,
.step-label {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0;
}

.app-header .eyebrow {
  color: #9fe6dc;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(1.9rem, 5vw, 3.2rem);
  line-height: 1.18;
  letter-spacing: 0;
}

.lead {
  max-width: 760px;
  margin: 14px 0 0;
  color: #d4ebe7;
  font-size: 1.02rem;
}

.layout {
  width: min(1120px, calc(100% - 32px));
  margin: 28px auto 48px;
  display: grid;
  grid-template-columns: minmax(0, 0.96fr) minmax(420px, 1.04fr);
  gap: 22px;
  align-items: start;
}

.input-panel,
.result-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.input-panel {
  padding: 24px;
  position: sticky;
  top: 16px;
}

.result-panel {
  padding: 24px;
}

.result-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.sliders-heading {
  margin-top: 24px;
}

h2 {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.35;
}

h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  font-weight: 700;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid #cbd3dc;
  background: #ffffff;
  color: var(--text);
  padding: 12px 13px;
  border-radius: 6px;
  outline: none;
  font-weight: 500;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.sliders {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.axis-control {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.axis-control:first-child {
  border-top: 0;
  padding-top: 0;
}

.axis-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.axis-title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  font-weight: 800;
}

.axis-code {
  color: var(--accent-dark);
}

.axis-description {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.score-badge {
  min-width: 52px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  padding: 5px 8px;
  text-align: center;
  font-weight: 800;
}

.risk-control .axis-code,
.risk-control .axis-description {
  color: var(--risk);
}

.risk-control .score-badge {
  background: var(--risk-soft);
  border-color: #f4b8af;
  color: var(--risk);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.risk-control input[type="range"] {
  accent-color: var(--risk);
}

.copy-button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 800;
  padding: 10px 14px;
  min-height: 42px;
  flex-shrink: 0;
}

.copy-button:hover,
.copy-button:focus-visible {
  background: var(--accent-dark);
}

.copy-status {
  min-height: 24px;
  margin-top: 8px;
  color: var(--accent-dark);
  font-size: 0.9rem;
  font-weight: 700;
}

.chart-area {
  display: grid;
  place-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 0 18px;
  border-bottom: 1px solid var(--line);
}

canvas {
  width: min(100%, 520px);
  height: auto;
  display: block;
}

.chart-note {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  color: var(--risk);
  font-size: 0.9rem;
}

.score-table-wrap {
  overflow-x: auto;
  margin-top: 18px;
}

.score-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 420px;
  font-size: 0.93rem;
}

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

.score-table th {
  color: var(--muted);
  font-size: 0.82rem;
}

.score-table td:last-child {
  width: 72px;
  font-weight: 800;
}

.risk-row {
  background: var(--risk-soft);
}

.diagnosis-block {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  border-radius: 8px;
}

.final-judgement {
  background: var(--accent-soft);
  border-color: #a8ded7;
}

.final-judgement p {
  margin: 0;
  color: var(--accent-dark);
  font-size: 1.12rem;
  font-weight: 900;
}

.diagnosis-block p {
  margin: 0;
}

.diagnosis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 18px;
}

.diagnosis-grid .diagnosis-block {
  margin-top: 0;
}

.risk-block {
  background: var(--risk-soft);
  border-color: #f4b8af;
}

ul {
  margin: 0;
  padding-left: 18px;
}

li + li {
  margin-top: 6px;
}

.empty {
  color: var(--muted);
}

/* スライダー端ラベル（S軸など） */
.range-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 3px;
  font-size: 0.75rem;
  font-weight: 600;
}

.range-label-min { color: #b42318; }
.range-label-max { color: var(--accent-dark); }

/* 診断ボタン */
.diagnose-button {
  display: block;
  width: 100%;
  margin-top: 22px;
  padding: 14px;
  background: #14302d;
  color: #ffffff;
  border: 0;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background 0.15s;
}

.diagnose-button:hover,
.diagnose-button:focus-visible {
  background: var(--accent-dark);
}

/* 診断前の案内 */
.pending-message {
  margin-top: 24px;
  padding: 28px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.8;
  border: 1.5px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

/* 事業内容インサイト */
.desc-insights-block {
  background: #f0faf8;
  border-color: #a8ded7;
}

.desc-insights-block h3 {
  color: var(--accent-dark);
}

.insight-tag {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: middle;
}

/* 注意書き */
.disclaimer {
  margin-top: 20px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafafa;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.7;
}

@media (max-width: 920px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .input-panel {
    position: static;
  }
}

@media (max-width: 620px) {
  .layout {
    width: min(100% - 20px, 1120px);
    margin-top: 18px;
  }

  .app-header {
    padding: 32px 16px 26px;
  }

  .input-panel,
  .result-panel {
    padding: 18px;
  }

  .result-top {
    display: grid;
  }

  .copy-button {
    width: 100%;
  }

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

  .axis-row {
    grid-template-columns: 1fr;
  }

  .score-badge {
    width: 100%;
  }
}
