:root {
  --bg: #f7f8f6;
  --card: #ffffff;
  --text: #25312f;
  --muted: #65716e;
  --line: #dde4df;
  --accent: #2f7568;
  --accent-dark: #245d52;
  --soft-accent: #e5f1ee;
  --warm: #f5efe7;
  --warm-line: #eadfce;
  --shadow: 0 18px 50px rgba(31, 50, 45, 0.1);
}

* {
  box-sizing: border-box;
}

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

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 860px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 16px;
  display: grid;
  place-items: center;
}

.screen {
  display: none;
  width: 100%;
}

.screen.is-active {
  display: block;
}

.app-card {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: clamp(24px, 5vw, 44px);
}

.top-bar {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 700;
}

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

h1 {
  margin: 0 0 18px;
  font-size: clamp(2.1rem, 8vw, 3.6rem);
  line-height: 1.15;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 18px;
  font-size: clamp(1.35rem, 4.5vw, 2rem);
  line-height: 1.35;
  letter-spacing: 0;
}

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

.lead,
.result-description,
.support-lead {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.flow-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 26px;
}

.flow-item {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.flow-item span {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  margin-bottom: 10px;
  border-radius: 999px;
  background: var(--soft-accent);
  color: var(--accent-dark);
  font-weight: 800;
}

.flow-item h2 {
  margin-bottom: 6px;
  font-size: 1rem;
}

.flow-item p,
.history-card p,
.latest-record p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.latest-record,
.action-box,
.summary-box {
  margin-top: 24px;
  padding: 18px;
  border-radius: 8px;
}

.latest-record {
  background: var(--warm);
  border: 1px solid var(--warm-line);
}

.latest-record strong {
  display: block;
  margin-bottom: 4px;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 28px;
}

.primary-button,
.secondary-button,
.ghost-button,
.choice-button,
.text-button {
  min-height: 52px;
  border-radius: 8px;
  font-weight: 700;
  transition:
    transform 150ms ease,
    background-color 150ms ease,
    border-color 150ms ease;
}

.primary-button,
.secondary-button,
.ghost-button {
  width: 100%;
  padding: 12px 16px;
}

.primary-button {
  border: 0;
  background: var(--accent);
  color: #fff;
}

.secondary-button {
  border: 0;
  background: var(--text);
  color: #fff;
}

.ghost-button,
.text-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.text-button {
  width: auto;
  min-height: 40px;
  padding: 8px 12px;
}

.choice-list {
  display: grid;
  gap: 12px;
}

.choice-button {
  width: 100%;
  padding: 16px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  text-align: left;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.choice-button:hover,
.text-button:hover {
  transform: translateY(-1px);
}

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

.choice-button:hover,
.choice-button:focus-visible,
.ghost-button:hover,
.text-button:hover {
  background: var(--soft-accent);
  border-color: #a9cbc3;
}

.progress-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  color: var(--muted);
  font-weight: 700;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  background: #ecf0ed;
  border-radius: 999px;
}

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

.action-box {
  background: var(--soft-accent);
  border: 1px solid #cfe2dc;
}

.action-box p,
.summary-box p {
  margin: 0;
  white-space: pre-line;
}

.support-panel {
  margin-top: 28px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.field-list {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.input-field,
.memo-field {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
}

.input-field small {
  color: var(--muted);
  font-weight: 400;
}

textarea,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  color: var(--text);
  background: #fff;
  font-weight: 400;
  line-height: 1.6;
}

textarea {
  resize: vertical;
}

textarea:focus,
input:focus {
  outline: 3px solid rgba(47, 117, 104, 0.16);
  border-color: var(--accent);
}

.summary-box {
  background: #fbfcfb;
  border: 1px solid var(--line);
}

.memo-field {
  margin-top: 22px;
}

.save-status {
  min-height: 1.4em;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.history-list {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.history-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.history-card strong,
.history-card time {
  display: block;
}

.history-card time {
  color: var(--muted);
  font-size: 0.9rem;
}

.empty-state {
  margin-top: 22px;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

@media (max-width: 700px) {
  .flow-grid,
  .button-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .app-shell {
    padding: 14px;
    align-items: stretch;
  }

  .app-card {
    margin: auto 0;
    padding: 22px 18px;
  }

  .progress-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}
