.reference {
  padding-bottom: 4rem;
}
.refhead {
  max-width: 900px;
  padding: 2.5rem 0 1.85rem;
}
.refhead h1 {
  font-size: clamp(2.6rem, 5.2vw, 4.65rem);
  letter-spacing: -0.064em;
  margin: 0.8rem 0 1.05rem;
}
.refhead > p:last-child {
  font-size: clamp(1.05rem, 1.5vw, 1.25rem);
  line-height: 1.55;
  max-width: 760px;
  color: var(--muted);
}
.jumpnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1.3rem;
  padding: 0.9rem 0;
  border-block: 1px solid var(--line);
}
.jumpnav a,
.refgroup p a,
.refnote a,
.ref-api a,
.scenario-share a {
  color: var(--violet);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.jumpnav a {
  font-size: 0.9rem;
  font-weight: 590;
}
.refnote {
  background: #efeff8;
  border-radius: 10px;
  color: #39394c;
  padding: 1rem 1.3rem;
  line-height: 1.65;
  margin: 1.25rem 0 2rem;
}
.refgroup {
  padding-top: 1.8rem;
}
.refgroup h2 {
  font-size: clamp(1.65rem, 2.5vw, 2.2rem);
  letter-spacing: -0.045em;
  margin-bottom: 0.8rem;
}
.refgroup p {
  max-width: 850px;
  margin: 0 0 0.75rem;
  line-height: 1.65;
  color: var(--muted);
}
.refgroup pre {
  margin: 1rem 0;
  padding: 1.2rem;
  background: var(--ink);
  color: #eceaff;
  border-radius: 10px;
  max-width: 850px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ref-table {
  width: 100%;
  overflow-x: auto;
}
.ref-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.91rem;
}
.ref-table th,
.ref-table td {
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  padding: 0.8rem 0.7rem;
}
.ref-table thead th {
  color: var(--muted);
  font-size: 0.77rem;
  background: #edeee8;
}
.ref-table tbody th {
  font-weight: 520;
}
.ref-table tr:target {
  background: #efedfc;
}
.ref-table td:nth-child(2) {
  min-width: 150px;
}
.refanchor {
  color: var(--ink);
  text-underline-offset: 4px;
}
.refanchor:hover,
.refanchor:focus-visible {
  text-decoration: underline;
  color: var(--violet);
}
.ref-mode {
  display: table;
  margin-top: 0.35rem;
  border-radius: 5px;
  padding: 0.02rem 0.45rem;
  background: #edf0eb;
  font-size: 0.73rem;
  letter-spacing: 0.02em;
  color: #35423c;
}
.ref-mode.write {
  background: #eeeafa;
  color: #4b3596;
}
.ref-api {
  display: block;
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.82rem;
}
.ref-table td code,
.refnote code {
  overflow-wrap: anywhere;
  font-size: 0.88em;
}
.visuallyhidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.quota-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1rem;
  background: #f0f1eb;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 1rem;
}
.quota-inputs {
  margin: 0;
  min-width: 0;
  padding: 1.2rem;
  border: 0;
}
.quota-inputs legend {
  float: left;
  width: 100%;
  margin: 0 0 1.2rem;
  font-size: 1.35rem;
  font-weight: 610;
  letter-spacing: -0.035em;
}
.quota-fields {
  clear: both;
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr 1fr;
}
.quota-fields label {
  display: flex;
  flex-direction: column;
  justify-content: end;
  gap: 0.4rem;
  font-size: 0.91rem;
  font-weight: 590;
}
.quota-fields input {
  width: 100%;
  min-width: 0;
  padding: 0.6rem 0.7rem;
  border: 1px solid #b7bab9;
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
}
.quota-fields input:invalid {
  border-color: #9a372c;
}
.calc-hint {
  font-size: 0.85rem;
  margin-top: 1rem;
  color: var(--muted);
  line-height: 1.55;
}
.quota-result {
  min-width: 0;
  background: #26263d;
  color: #fff;
  border-radius: 10px;
  padding: clamp(1.2rem, 2.6vw, 2rem);
  display: flex;
  flex-direction: column;
}
.quota-result > p {
  color: #c9c6dc;
  font-size: 0.91rem;
}
.quota-result > strong {
  font-weight: 540;
  letter-spacing: -0.07em;
  font-size: clamp(1.8rem, 4.2vw, 3.9rem);
  line-height: 1.24;
  overflow-wrap: anywhere;
  margin-bottom: 1rem;
}
.quota-result dl {
  margin: 0;
  border-top: 1px solid #515168;
}
.quota-result dl > div {
  display: flex;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid #515168;
}
.quota-result dt {
  color: #d0cde1;
  font-size: 0.83rem;
}
.quota-result dd {
  text-align: right;
  margin: 0;
  font-size: 0.89rem;
  font-weight: 550;
  overflow-wrap: anywhere;
}
.scenario-share {
  margin-top: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.scenario-share output {
  font-size: 0.85rem;
  max-width: 100%;
  overflow-wrap: anywhere;
}
@media (max-width: 740px) {
  .quota-grid {
    grid-template-columns: 1fr;
  }
  .quota-inputs {
    padding: 0.4rem;
  }
  .ref-table table {
    min-width: 610px;
  }
  .refhead {
    padding-top: 1.6rem;
  }
  .quota-result > strong {
    font-size: 2.65rem;
  }
}
@media (max-width: 410px) {
  .quota-fields {
    grid-template-columns: 1fr;
  }
  .quota-fields label {
    gap: 0.2rem;
  }
  .quota-fields {
    gap: 0.6rem;
  }
}
@media (max-width: 740px) {
  .toolmatrix table,
  .toolmatrix tbody,
  .toolmatrix tr,
  .toolmatrix th,
  .toolmatrix td {
    display: block;
    min-width: 0;
    width: 100%;
  }
  .toolmatrix thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .toolmatrix tbody tr {
    border-top: 1px solid var(--line);
    padding: 0.65rem 0 0.95rem;
  }
  .toolmatrix tbody th,
  .toolmatrix tbody td {
    padding: 0.25rem 0.1rem;
    border: 0;
  }
  .toolmatrix tbody td:nth-child(2) {
    font-size: 0.85rem;
    color: var(--muted);
  }
  .toolmatrix tbody td:nth-child(2)::before {
    content: "Required inputs · ";
    font-weight: 600;
  }
  .toolmatrix .ref-mode {
    display: inline-block;
    margin: 0 0 0 0.45rem;
    vertical-align: middle;
  }
}
