:root {
  color-scheme: light;
  --ink: #15233a;
  --muted: #6a7688;
  --line: #dfe5ec;
  --soft-line: #ebeff3;
  --paper: #ffffff;
  --canvas: #f4f6f8;
  --navy: #14243d;
  --blue: #2878d4;
  --blue-soft: #eaf3fd;
  --coral: #e36f51;
  --coral-soft: #fff0eb;
  --amber: #c98916;
  --amber-soft: #fff7e6;
  --green: #238263;
  --green-soft: #eaf7f2;
  --shadow: 0 18px 50px rgba(24, 39, 61, 0.08);
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  scroll-behavior: smooth;
  background: var(--canvas);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Noto Sans JP", "Yu Gothic UI", "Hiragino Kaku Gothic ProN", system-ui, sans-serif;
  background:
    linear-gradient(90deg, rgba(20, 36, 61, 0.025) 1px, transparent 1px),
    linear-gradient(rgba(20, 36, 61, 0.025) 1px, transparent 1px),
    var(--canvas);
  background-size: 32px 32px;
}

button, textarea { font: inherit; }
button { color: inherit; }

.topbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  color: var(--navy);
  font-size: 0.96rem;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: white;
  border-radius: 9px;
  background: var(--navy);
  font-family: Georgia, serif;
  font-size: 1rem;
}

.status-badge {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  padding: 7px 11px;
  color: #416459;
  border: 1px solid #c9e5da;
  border-radius: 999px;
  background: #f0faf6;
  font-size: 0.7rem;
  font-weight: 700;
}

.status-badge span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #39a87f;
  box-shadow: 0 0 0 3px rgba(57, 168, 127, 0.12);
}

.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.hero {
  position: relative;
  padding: 74px 0 49px;
  text-align: center;
}

.hero::after {
  position: absolute;
  top: 44px;
  left: 50%;
  z-index: -1;
  width: 400px;
  height: 180px;
  border-radius: 50%;
  background: rgba(40, 120, 212, 0.06);
  filter: blur(45px);
  content: "";
  transform: translateX(-50%);
}

.eyebrow, .step-label {
  margin: 0 0 12px;
  color: var(--blue);
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.17em;
}

.hero h1 {
  margin: 0;
  color: var(--navy);
  font-family: "Yu Mincho", "Hiragino Mincho ProN", Georgia, serif;
  font-size: clamp(2.35rem, 5.2vw, 4.35rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.hero h1 span { position: relative; color: var(--coral); }

.hero h1 span::after {
  position: absolute;
  right: 0;
  bottom: -5px;
  left: 0;
  height: 3px;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, rgba(227, 111, 81, 0.45), transparent);
  content: "";
}

.hero-copy {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.9;
}

.privacy-note {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  margin-top: 19px;
  padding: 8px 13px;
  color: #5b6a7c;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  font-size: 0.72rem;
}

.privacy-note span {
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  color: white;
  border-radius: 50%;
  background: var(--green);
  font-size: 0.62rem;
  font-weight: 900;
}

.workspace, .results-section {
  padding: clamp(24px, 4vw, 38px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.section-heading, .results-heading {
  display: flex;
  gap: 20px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 25px;
}

.section-heading .step-label, .results-heading .step-label { margin-bottom: 6px; }

.section-heading h2, .results-heading h2 {
  margin: 0;
  color: var(--navy);
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.text-button {
  padding: 7px 2px;
  color: var(--blue);
  border: 0;
  border-bottom: 1px solid rgba(40, 120, 212, 0.28);
  background: transparent;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
}

.text-button:hover { border-bottom-color: var(--blue); }

.input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.input-panel {
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fafbfc;
}

.current-panel { border-top-color: rgba(227, 111, 81, 0.48); }

.panel-heading {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 15px;
}

.panel-number {
  display: grid;
  flex: 0 0 auto;
  width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 8px;
  font-size: 0.77rem;
  font-weight: 900;
}

.panel-number.past { color: var(--blue); background: var(--blue-soft); }
.panel-number.current { color: var(--coral); background: var(--coral-soft); }

.panel-heading label {
  display: block;
  color: var(--navy);
  font-size: 0.9rem;
  font-weight: 800;
}

.panel-heading p { margin: 3px 0 0; color: var(--muted); font-size: 0.7rem; }

textarea {
  display: block;
  width: 100%;
  min-height: 245px;
  resize: vertical;
  padding: 15px 16px;
  color: #24344d;
  border: 1px solid #d8dfe7;
  border-radius: 9px;
  outline: none;
  background: white;
  font-size: 0.86rem;
  line-height: 1.75;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

textarea::placeholder { color: #9aa4b0; }
textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(40, 120, 212, 0.1); }
textarea[aria-invalid="true"] { border-color: #cb503d; box-shadow: 0 0 0 3px rgba(203, 80, 61, 0.09); }

.field-meta {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-top: 9px;
  color: #8a94a1;
  font-size: 0.64rem;
}

.error-message {
  margin-top: 17px;
  padding: 11px 14px;
  color: #9e3628;
  border: 1px solid #f0c9c1;
  border-radius: 9px;
  background: #fff5f2;
  font-size: 0.8rem;
  line-height: 1.6;
}

.action-row {
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 24px;
}

.action-row > p { margin: 0; color: #929ba6; font-size: 0.69rem; }

kbd {
  padding: 2px 5px;
  border: 1px solid #d9dee4;
  border-bottom-width: 2px;
  border-radius: 4px;
  background: #f6f7f8;
  font-family: inherit;
  font-size: 0.63rem;
}

.primary-button {
  position: relative;
  display: inline-flex;
  min-width: 215px;
  gap: 10px;
  align-items: center;
  justify-content: center;
  padding: 14px 22px;
  color: white;
  border: 0;
  border-radius: 9px;
  background: var(--navy);
  box-shadow: 0 8px 20px rgba(20, 36, 61, 0.18);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 800;
  transition: background 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.primary-button:hover:not(:disabled) {
  background: #1d3659;
  box-shadow: 0 10px 24px rgba(20, 36, 61, 0.24);
  transform: translateY(-1px);
}

.primary-button:active:not(:disabled) { transform: translateY(1px); }
.primary-button:disabled { cursor: wait; opacity: 0.72; }
.button-icon { color: #8ec3ff; font-size: 1.05rem; }

.spinner {
  display: none;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.primary-button.loading .button-icon { display: none; }
.primary-button.loading .spinner { display: inline-block; }

.results-section { margin-top: 22px; animation: reveal 320ms ease both; }
.result-summary { margin: 0; color: var(--muted); font-size: 0.76rem; }
.result-summary strong { color: var(--navy); }

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.result-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.result-card header {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--soft-line);
}

.result-icon {
  display: grid;
  flex: 0 0 auto;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 8px;
  font-size: 0.87rem;
  font-weight: 900;
}

.result-card header div { flex: 1; }

.result-card header p {
  margin: 0 0 2px;
  font-size: 0.56rem;
  font-weight: 900;
  letter-spacing: 0.15em;
}

.result-card h3 { margin: 0; color: var(--navy); font-size: 0.9rem; }

.count-badge {
  display: grid;
  min-width: 25px;
  height: 25px;
  padding: 0 6px;
  place-items: center;
  border-radius: 99px;
  font-size: 0.69rem;
  font-weight: 800;
}

.changes header { background: #f5f9fe; }
.changes .result-icon, .changes .count-badge { color: var(--blue); background: var(--blue-soft); }
.changes header p { color: var(--blue); }
.additions header { background: #f4faf7; }
.additions .result-icon, .additions .count-badge { color: var(--green); background: var(--green-soft); }
.additions header p { color: var(--green); }
.warnings header { background: #fff9ee; }
.warnings .result-icon, .warnings .count-badge { color: var(--amber); background: var(--amber-soft); }
.warnings header p { color: var(--amber); }
.questions header { background: #fff6f3; }
.questions .result-icon, .questions .count-badge { color: var(--coral); background: var(--coral-soft); }
.questions header p { color: var(--coral); }

.result-card ul {
  margin: 0;
  padding: 9px 18px 12px 41px;
  color: #435167;
  font-size: 0.79rem;
  line-height: 1.7;
}

.result-card li { padding: 7px 0 7px 2px; border-bottom: 1px dashed #edf0f3; }
.result-card li:last-child { border-bottom: 0; }
.result-card li::marker { color: #9aa5b2; }
.result-card li.empty-item { color: #7c8795; font-style: italic; }

.analysis-note {
  margin: 18px 0 0;
  padding: 11px 14px;
  color: #7c8795;
  border-left: 3px solid #c8d0d9;
  background: #f8f9fa;
  font-size: 0.68rem;
  line-height: 1.65;
}

.footer { padding: 30px 20px 34px; color: #8a94a1; font-size: 0.7rem; text-align: center; }
.footer p { margin: 0; }
.footer span { margin: 0 7px; color: #c0c7cf; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 780px) {
  .input-grid, .result-grid { grid-template-columns: 1fr; }
  .hero { padding-top: 55px; }
  textarea { min-height: 210px; }
}

@media (max-width: 520px) {
  .topbar { height: 60px; padding: 0 15px; }
  .brand { font-size: 0.82rem; }
  .brand-mark { width: 30px; height: 30px; }
  .status-badge { padding: 6px 8px; font-size: 0.62rem; }
  .page-shell { width: min(100% - 20px, 1180px); }
  .hero { padding: 44px 8px 35px; }
  .hero h1 { font-size: clamp(2rem, 11vw, 3rem); }
  .hero-copy { font-size: 0.86rem; }
  .desktop-only { display: none; }
  .privacy-note { align-items: flex-start; text-align: left; }
  .workspace, .results-section { padding: 19px 15px; border-radius: 13px; }
  .input-panel { padding: 15px; }
  .field-meta span:first-child, .action-row > p { display: none; }
  .field-meta { justify-content: flex-end; }
  .action-row { margin-top: 18px; }
  .primary-button { width: 100%; }
  .section-heading, .results-heading { align-items: center; }
  .result-summary { max-width: 45%; text-align: right; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
