:root {
  --ink: #233544;
  --ink-soft: #536672;
  --muted: #78858a;
  --paper: #fbfaf7;
  --white: #ffffff;
  --line: #d9e0df;
  --blue: #527789;
  --blue-dark: #355b6e;
  --blue-pale: #edf3f3;
  --orange: #e58b54;
  --orange-dark: #bd6437;
  --orange-pale: #fff0e7;
  --yellow-pale: #fff8dc;
  --shadow: 0 16px 45px rgba(45, 68, 78, 0.08);
  --radius: 18px;
  --font-body: "Hiragino Kaku Gothic ProN", "Yu Gothic", "YuGothic", system-ui, sans-serif;
  --font-display: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", serif;
}

* {
  box-sizing: border-box;
}

html {
  color: var(--ink);
  background: var(--paper);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  letter-spacing: 0.015em;
  background:
    radial-gradient(circle at 90% 4%, rgba(229, 139, 84, 0.12), transparent 23rem),
    linear-gradient(180deg, #f6f8f6 0, var(--paper) 30rem);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible,
.table-scroll:focus-visible {
  outline: 3px solid rgba(229, 139, 84, 0.75);
  outline-offset: 3px;
}

img {
  max-width: 100%;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: -4rem;
  left: 1rem;
  padding: 0.65rem 1rem;
  color: var(--white);
  background: var(--blue-dark);
  border-radius: 0 0 8px 8px;
}

.skip-link:focus {
  top: 0;
}

.section-shell {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  position: relative;
  z-index: 5;
  border-bottom: 1px solid rgba(217, 224, 223, 0.7);
  background: rgba(251, 250, 247, 0.9);
  backdrop-filter: blur(14px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1200px, calc(100% - 40px));
  min-height: 72px;
  margin-inline: auto;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--white);
  font-family: var(--font-display);
  font-size: 1.15rem;
  background: var(--blue);
  border-radius: 10px 4px 10px 4px;
  transform: rotate(-3deg);
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.07fr) minmax(320px, 0.93fr);
  align-items: center;
  min-height: 510px;
  padding-block: 62px 56px;
  gap: 2rem;
}

.eyebrow {
  margin: 0 0 0.8rem;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.03em;
}

h1 {
  max-width: 680px;
  margin-bottom: 1.25rem;
  font-size: clamp(2.35rem, 5vw, 4.4rem);
  line-height: 1.18;
}

h1 span {
  color: var(--orange-dark);
}

.hero-lede {
  max-width: 580px;
  margin-bottom: 1.55rem;
  color: var(--ink-soft);
  font-size: 1.08rem;
}

.hero-note {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.75rem;
  max-width: 390px;
  padding: 0.85rem 1rem;
  color: var(--blue-dark);
  background: var(--yellow-pale);
  border: 1px solid #f1e6ae;
  border-radius: 5px 13px 8px 15px;
  transform: rotate(-1deg);
}

.hero-note p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
}

.pin-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  margin-top: 0.35rem;
  background: var(--orange);
  border-radius: 50%;
  box-shadow: inset -2px -2px 0 rgba(133, 69, 37, 0.18);
}

.hero-visual {
  position: relative;
  min-height: 360px;
  isolation: isolate;
}

.visual-backdrop {
  position: absolute;
  inset: 34px 12px 8px 22px;
  z-index: -1;
  background: #dce9e7;
  border-radius: 45% 20% 35% 18%;
  transform: rotate(5deg);
}

.hero-visual img {
  display: block;
  width: 100%;
  height: 360px;
  object-fit: cover;
  border: 9px solid var(--white);
  border-radius: 11px 30px 13px 29px;
  box-shadow: 0 22px 40px rgba(46, 73, 83, 0.18);
  transform: rotate(-3deg);
}

.visual-card {
  position: absolute;
  padding: 0.55rem 0.8rem;
  font-size: 0.83rem;
  line-height: 1.35;
  box-shadow: 0 10px 22px rgba(43, 63, 70, 0.13);
}

.visual-card strong {
  font-size: 1rem;
}

.visual-card-blue {
  top: 6px;
  right: -8px;
  color: var(--white);
  background: var(--blue);
  border-radius: 4px 14px 5px 12px;
  transform: rotate(7deg);
}

.visual-card-orange {
  bottom: -8px;
  left: -10px;
  color: #63361f;
  background: #ffdcae;
  border-radius: 12px 4px 12px 7px;
  transform: rotate(-6deg);
}

.message {
  width: min(1120px, calc(100% - 40px));
  margin: -6px auto 30px;
  padding: 0.85rem 1rem;
  color: #71391f;
  background: var(--orange-pale);
  border: 1px solid #f0bf9e;
  border-radius: 10px;
}

.editor-section,
.result-section,
.tools-section {
  padding-block: 54px;
}

.section-intro {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: start;
  gap: 1rem;
  margin-bottom: 22px;
}

.section-number {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  color: var(--blue-dark);
  font-family: var(--font-display);
  font-size: 1.35rem;
  background: var(--blue-pale);
  border-radius: 17px 5px 13px 6px;
  transform: rotate(-4deg);
}

.section-number-orange {
  color: var(--orange-dark);
  background: var(--orange-pale);
  transform: rotate(4deg);
}

.section-intro h2 {
  margin-bottom: 0.45rem;
  font-size: clamp(1.65rem, 3vw, 2.25rem);
  line-height: 1.25;
}

.section-intro p:not(.eyebrow) {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--ink-soft);
}

.paper-card {
  padding: clamp(1.15rem, 3vw, 2rem);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: var(--radius) 8px var(--radius) 10px;
  box-shadow: var(--shadow);
}

.form-row {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
}

.title-row {
  padding-bottom: 1.35rem;
  border-bottom: 1px dashed var(--line);
}

label,
.tool-label {
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 700;
}

input[type="text"],
input[type="number"] {
  width: 100%;
  min-height: 46px;
  padding: 0.6rem 0.75rem;
  font-size: 16px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid #bdccce;
  border-radius: 8px;
}

input[type="number"] {
  min-width: 80px;
}

input::placeholder {
  color: #9aa6a8;
}

.criteria-head,
.table-toolbar,
.card-heading-row,
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.criteria-head {
  padding-block: 1.25rem 0.8rem;
}

h3 {
  margin-bottom: 0.2rem;
  font-size: 1.15rem;
}

.criteria-head p,
.table-toolbar p,
.card-heading-row p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.count-badge,
.result-unit {
  display: inline-block;
  flex: 0 0 auto;
  padding: 0.28rem 0.62rem;
  color: var(--blue-dark);
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--blue-pale);
  border-radius: 999px;
}

.criteria-list {
  display: grid;
  gap: 0.7rem;
}

.criterion-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px 44px;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem;
  background: #f7faf9;
  border: 1px solid #e4ebea;
  border-radius: 8px 14px 10px 5px;
}

.criterion-row .weight-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--orange-dark);
  background: transparent;
  border: 1px solid #f0c3a9;
  border-radius: 8px 4px 8px 4px;
}

.icon-button:hover {
  color: var(--white);
  background: var(--orange);
}

.card-footer {
  align-items: flex-start;
  margin-top: 1.15rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--line);
}

.form-hint {
  padding-top: 0.55rem;
  color: var(--muted);
  font-size: 0.83rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.62rem 0.9rem;
  color: var(--blue-dark);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.25;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 8px 13px 9px 12px;
  transition: background 160ms ease, transform 160ms ease, border-color 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  color: var(--white);
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}

.button-primary:hover {
  background: #294b5b;
}

.button-outline {
  background: var(--white);
  border-color: #b6cacc;
}

.button-outline:hover,
.button-quiet:hover {
  background: var(--blue-pale);
  border-color: #88aab3;
}

.button-quiet {
  color: var(--blue);
  background: transparent;
  border-color: transparent;
}

.button-orange {
  color: #71391f;
  background: #ffd4b6;
  border-color: #efb58f;
}

.button-danger {
  color: #9a4d44;
  background: transparent;
  border-color: #e7bdb8;
}

.alternatives-card {
  width: 100%;
  min-width: 0;
  padding-bottom: 1.35rem;
  overflow-x: hidden;
}

.table-toolbar {
  align-items: flex-start;
  margin-bottom: 1rem;
}

.scale-note {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.scale-chip {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--white);
  font-size: 0.76rem;
  font-weight: 800;
  background: var(--blue);
  border-radius: 50%;
}

.scale-chip-high {
  background: var(--orange);
}

.table-scroll {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  contain: inline-size paint;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.3rem;
}

.score-table {
  width: 100%;
  min-width: 730px;
  border-collapse: separate;
  border-spacing: 0 0.5rem;
}

.score-table caption {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.score-table th {
  padding: 0.45rem 0.55rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: left;
  vertical-align: bottom;
}

.score-table th:not(:first-child):not(:nth-child(2)) {
  min-width: 102px;
  text-align: center;
}

.score-table td {
  padding: 0.5rem;
  background: #f7faf9;
  border-top: 1px solid #e4ebea;
  border-bottom: 1px solid #e4ebea;
}

.score-table td:first-child {
  width: 44px;
  color: var(--muted);
  text-align: center;
  border-left: 1px solid #e4ebea;
  border-radius: 8px 0 0 8px;
}

.score-table td:nth-child(2) {
  min-width: 175px;
}

.score-table td:last-child {
  border-right: 1px solid #e4ebea;
  border-radius: 0 8px 8px 0;
}

.score-table td.score-cell {
  min-width: 102px;
  text-align: center;
}

.score-table td.score-cell input {
  width: 76px;
  min-width: 76px;
  text-align: center;
}

.criterion-weight-label {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 400;
}

.remove-alternative {
  margin-left: 0.15rem;
}

.results-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.2rem;
}

.card-heading-row {
  align-items: flex-start;
  padding-bottom: 1rem;
  border-bottom: 1px dashed var(--line);
}

.results-list,
.sensitivity-list {
  display: grid;
  gap: 0.7rem;
  padding-top: 1rem;
}

.result-item {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem;
  background: #f7faf9;
  border: 1px solid #e4ebea;
  border-radius: 9px 15px 9px 12px;
}

.rank-badge {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--white);
  font-size: 0.88rem;
  font-weight: 800;
  background: var(--blue);
  border-radius: 50% 45% 52% 42%;
}

.rank-badge.incomplete {
  color: var(--orange-dark);
  background: var(--orange-pale);
  font-size: 0.72rem;
}

.result-name {
  margin-bottom: 0.1rem;
  font-weight: 700;
}

.result-missing {
  margin: 0;
  color: var(--orange-dark);
  font-size: 0.77rem;
}

.result-score {
  color: var(--blue-dark);
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 600;
  white-space: nowrap;
}

.result-score small {
  margin-left: 0.12rem;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.73rem;
}

.empty-state {
  margin: 0;
  padding: 1rem;
  color: var(--muted);
  text-align: center;
  background: #f7faf9;
  border-radius: 10px;
}

.sensitivity-item {
  padding: 0.8rem;
  background: var(--yellow-pale);
  border: 1px solid #f0e6b6;
  border-radius: 8px 14px 7px 12px;
}

.sensitivity-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.sensitivity-title strong {
  font-size: 0.92rem;
}

.sensitivity-title span {
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

.sensitivity-range {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
}

.range-chip {
  padding: 0.28rem 0.5rem;
  color: #71461d;
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid #ead9a0;
  border-radius: 999px;
}

.inline-errors {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  color: #8d3d34;
  background: #fff0ed;
  border: 1px solid #edc4bf;
  border-radius: 10px;
}

.inline-errors ul {
  margin: 0;
  padding-left: 1.3rem;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.1rem;
}

.tool-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.7rem;
  padding-right: 1rem;
  border-right: 1px dashed var(--line);
}

.tool-block-last {
  padding-right: 0;
  border-right: 0;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.privacy-note {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
}

.privacy-note span {
  color: var(--blue);
}

.site-footer {
  margin-top: 40px;
  color: #d7e4e5;
  background: var(--blue-dark);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 28px;
  font-size: 0.82rem;
}

.not-found {
  min-height: 70vh;
  padding-top: 15vh;
}

.not-found h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
}

@media (max-width: 850px) {
  .hero {
    grid-template-columns: 1fr;
    padding-top: 42px;
  }

  .hero-visual {
    width: min(650px, 100%);
    min-height: 285px;
    margin-inline: auto;
  }

  .hero-visual img {
    height: 285px;
  }

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

  .tool-block {
    padding-right: 0;
    padding-bottom: 1rem;
    border-right: 0;
    border-bottom: 1px dashed var(--line);
  }

  .tool-block-last {
    padding-bottom: 0;
    border-bottom: 0;
  }
}

@media (max-width: 600px) {
  .section-shell,
  .header-inner,
  .message {
    width: min(100% - 24px, 1120px);
  }

  .header-inner {
    align-items: flex-start;
    min-height: 0;
    padding-block: 12px;
  }

  .header-actions {
    gap: 0.1rem;
  }

  .header-actions .button {
    padding-inline: 0.5rem;
    font-size: 0.75rem;
  }

  .hero {
    min-height: 0;
    padding-block: 38px 34px;
  }

  h1 {
    font-size: clamp(2.1rem, 11vw, 3.2rem);
  }

  .hero-lede {
    font-size: 1rem;
  }

  .hero-visual {
    min-height: 210px;
  }

  .hero-visual img {
    height: 210px;
  }

  .visual-card {
    font-size: 0.72rem;
  }

  .section-intro {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 0.65rem;
  }

  .section-number {
    width: 39px;
    height: 39px;
    font-size: 1.05rem;
  }

  .editor-section,
  .result-section,
  .tools-section {
    padding-block: 35px;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .criterion-row {
    grid-template-columns: minmax(0, 1fr) 44px;
  }

  .criterion-row .weight-field {
    grid-column: 1 / 2;
  }

  .criterion-row .icon-button {
    grid-column: 2;
    grid-row: 1 / 3;
  }

  .criteria-head,
  .table-toolbar,
  .card-footer {
    align-items: flex-start;
  }

  .card-footer {
    flex-direction: column;
  }

  .result-item {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .result-score {
    grid-column: 2;
    font-size: 1.35rem;
  }

  .footer-inner {
    flex-direction: column;
  }
}

@media print {
  @page {
    margin: 13mm;
  }

  body {
    color: #000;
    background: #fff;
    font-size: 11pt;
  }

  .site-header,
  .hero-visual,
  .message,
  .tools-section,
  .site-footer,
  .button,
  .icon-button,
  .card-footer,
  .skip-link {
    display: none !important;
  }

  .section-shell {
    width: 100%;
  }

  .hero {
    display: block;
    min-height: 0;
    padding: 0 0 12mm;
  }

  .hero h1 {
    font-size: 26pt;
  }

  .editor-section,
  .result-section {
    padding: 7mm 0;
    break-inside: avoid;
  }

  .paper-card {
    padding: 5mm;
    border: 1px solid #aaa;
    box-shadow: none;
  }

  .table-scroll {
    overflow: visible;
  }

  .score-table {
    min-width: 0;
  }

  input {
    border: 0 !important;
    background: transparent !important;
  }
}
