:root {
  --bg: #f7f5f2;
  --surface: #ffffff;
  --surface-muted: #f0eeea;
  --text: #202124;
  --muted: #686f76;
  --line: #dfd8cf;
  --primary: #315f54;
  --primary-dark: #23483f;
  --primary-soft: #e4eee9;
  --danger: #9b2c2c;
  --radius: 18px;
  --shadow: 0 18px 40px rgba(42, 46, 50, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.app-shell {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px 16px 32px;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 2px 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin: 0;
  font-size: 1.7rem;
  line-height: 1.15;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 10px;
  font-size: 1.35rem;
  line-height: 1.2;
}

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

p {
  margin: 0;
}

.app-content {
  display: grid;
  gap: 16px;
}

.card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stack {
  display: grid;
  gap: 16px;
}

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

.compact {
  font-size: 0.93rem;
}

.button-row {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 50px;
  border-radius: 999px;
  padding: 12px 18px;
  border: 1px solid transparent;
  font-weight: 700;
}

.primary-button {
  color: #ffffff;
  border-color: var(--primary);
  background: var(--primary);
}

.primary-button:active {
  background: var(--primary-dark);
}

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

.ghost-button {
  min-height: 40px;
  padding: 8px 12px;
  color: var(--muted);
  border-color: transparent;
  background: transparent;
}

.danger-button {
  min-height: 50px;
  border: 1px solid rgba(155, 44, 44, 0.34);
  border-radius: 999px;
  padding: 12px 18px;
  color: var(--danger);
  background: var(--surface);
  font-weight: 800;
}

.hidden {
  display: none;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  font-size: 0.92rem;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-muted);
}

.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 180ms ease;
}

.vas-control {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.vas-value {
  justify-self: center;
  min-width: 66px;
  padding: 8px 12px;
  border-radius: 999px;
  text-align: center;
  color: var(--primary-dark);
  background: var(--primary-soft);
  font-size: 1.3rem;
  font-weight: 800;
}

.vas-slider {
  width: 100%;
  accent-color: var(--primary);
}

.scale-labels {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

.scale-labels span {
  max-width: 48%;
}

.scale-labels span:last-child {
  text-align: right;
}

.review-list,
.result-list,
.export-box {
  display: grid;
  gap: 10px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

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

.pill {
  flex: 0 0 auto;
  min-width: 42px;
  padding: 6px 10px;
  border-radius: 999px;
  text-align: center;
  color: var(--primary-dark);
  background: var(--primary-soft);
  font-weight: 800;
}

.dimension-grid {
  display: grid;
  gap: 12px;
}

.dimension-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.dimension-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-muted);
}

.dimension-tab {
  min-width: 0;
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.dimension-tab[aria-selected="true"] {
  color: #ffffff;
  background: var(--primary);
}

.dimension-detail {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

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

.dimension-score {
  flex: 0 0 auto;
  min-width: 74px;
  padding: 10px 12px;
  border-radius: 16px;
  text-align: center;
  color: var(--primary-dark);
  background: var(--primary-soft);
  font-size: 2rem;
  line-height: 1;
}

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

.question-list h3 {
  margin: 0;
}

.question-item {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
}

.radar-wrap {
  display: grid;
  place-items: center;
  padding: 8px 0;
}

.radar-chart {
  width: min(100%, 360px);
  height: auto;
  overflow: visible;
}

.radar-grid {
  fill: none;
  stroke: var(--line);
  stroke-width: 1;
}

.radar-axis {
  stroke: var(--line);
  stroke-width: 1;
}

.radar-result {
  fill: rgba(49, 95, 84, 0.22);
  stroke: var(--primary);
  stroke-width: 3;
}

.radar-dot {
  fill: var(--primary-dark);
}

.radar-label {
  fill: var(--text);
  font-size: 10px;
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: central;
}

.radar-legend {
  display: grid;
  gap: 6px;
  width: min(100%, 360px);
  margin: 4px auto 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.radar-legend div {
  display: flex;
  gap: 6px;
}

.radar-legend strong {
  color: var(--primary-dark);
}

.score-section {
  display: grid;
  gap: 12px;
}

.score-section h3 {
  margin: 0;
}

.score-bars {
  display: grid;
  gap: 12px;
}

.score-bar-row {
  display: grid;
  gap: 7px;
}

.score-bar-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
  font-size: 0.93rem;
  font-weight: 700;
}

.metric-title,
.metric-subtitle {
  display: block;
}

.metric-title {
  color: var(--text);
  font-weight: 800;
}

.metric-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.score-bar-header strong {
  flex: 0 0 auto;
  color: var(--primary-dark);
}

.score-bar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-muted);
}

.score-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.translation-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.export-data {
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-muted);
  font-size: 0.85rem;
}

.report-screen {
  gap: 18px;
}

.report-actions {
  print-color-adjust: exact;
}

.reset-action {
  display: grid;
  justify-items: start;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.report-panel {
  display: grid;
  gap: 22px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

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

.report-section {
  display: grid;
  gap: 12px;
}

.report-section h3 {
  margin: 0;
}

.report-score {
  color: var(--primary-dark);
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1;
}

.narrative-answer {
  display: grid;
  gap: 6px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.narrative-answer:last-child {
  border-bottom: 0;
}

.narrative-answer h4 {
  margin: 0;
  font-size: 0.95rem;
}

.report-note {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--muted);
  background: var(--surface-muted);
  font-size: 0.92rem;
}

@media (min-width: 640px) {
  .app-shell {
    padding: 36px 24px 48px;
  }

  .app-header {
    padding-bottom: 24px;
  }

  h1 {
    font-size: 2rem;
  }

  .card {
    padding: 28px;
  }

  .button-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 420px) {
  .dimension-heading {
    display: grid;
  }

  .dimension-score,
  .report-header {
    justify-self: start;
  }

  .report-header {
    display: grid;
  }
}

@media print {
  body,
  html {
    background: #ffffff;
  }

  .app-shell {
    width: 100%;
    min-height: auto;
    padding: 0;
  }

  .app-header,
  .report-actions {
    display: none;
  }

  .app-content {
    display: block;
  }

  .report-screen > :not(.report-panel) {
    display: none;
  }

  .card {
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .report-panel {
    padding: 0;
    border: 0;
    border-radius: 0;
  }

  .radar-result {
    fill: rgba(49, 95, 84, 0.18);
  }

  .score-bar-fill,
  .radar-result,
  .radar-dot {
    print-color-adjust: exact;
  }
}
