#tuning-calculator { min-width: 0; }
#tuning-calculator .tune-inputs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
#tuning-calculator .tune-axes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#tuning-calculator label { display: grid; gap: 6px; align-content: start; font-weight: 650; }
#tuning-calculator input, #tuning-calculator textarea {
  width: 100%;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.4 var(--sans);
  font-variant-numeric: tabular-nums;
}
#tuning-calculator textarea { resize: vertical; }
.tune-result-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 12px 16px;
  margin: 0 0 22px;
  background: #e9eee3;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.tune-result-stats dd { margin: 2px 0 0; font-size: 21px; font-weight: 700; overflow-wrap: anywhere; }
.tune-table-wrap { max-width: 100%; overflow-x: auto; }
.tune-table-wrap table { width: 100%; border-collapse: collapse; text-align: left; font-variant-numeric: tabular-nums; }
.tune-table-wrap td, .tune-table-wrap th { border-bottom: 1px solid var(--line); padding: 6px 9px; }
.tune-table-wrap thead, .tune-table-wrap tbody th { background: #e9eee3; }
#tuning-calculator .tune-table-wrap input { min-width: 70px; padding: 4px 6px; }
.tune-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 14px; }
.tune-actions button:disabled { opacity: .55; cursor: default; }
.tune-note, .tune-status { margin: 8px 0; color: var(--muted); }
.tune-status:empty { margin: 0; }
.tune-status[data-error], #tune-scale-error { color: #a11919; }
@media (max-width: 680px) {
  #tuning-calculator .tune-inputs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #tuning-calculator .tune-axes { grid-template-columns: 1fr; }
}

.tune-sheet {
  padding: 14px;
  border: 1px solid #d9ded8;
  background: repeating-linear-gradient(#dfe4df 0 1px, transparent 1px 20px),
    repeating-linear-gradient(90deg, #dfe4df 0 1px, #fff 1px 36px);
  font-family: Arial, sans-serif;
}
.tune-sheet h1 {
  margin: 0 0 10px;
  color: #006cb7;
  font: 700 clamp(20px, 2.5vw, 25px)/1.2 Arial, sans-serif;
  letter-spacing: 0;
}
.tune-sheet-map h2 {
  margin: 0;
  padding: 5px 8px;
  background: #fff;
  color: #151915;
  font: 700 13px/1.2 Arial, sans-serif;
  letter-spacing: .035em;
  text-align: center;
  text-transform: uppercase;
}
.tune-sheet-map h2 span {
  margin-left: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}
.tune-sheet-grid {
  container-type: inline-size;
  border: 1px solid #d5dad4;
  background: #fff;
}
.tune-sheet table {
  table-layout: fixed;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: #101510;
  font: 11px/1.25 Arial, sans-serif;
  font-size: clamp(4px, calc(100cqw / var(--map-columns, 31) / 3.1), 11px);
  font-variant-numeric: tabular-nums;
}
.tune-sheet th, .tune-sheet td {
  position: relative;
  padding: 2px 1px;
  border-right: 1px solid rgb(0 0 0 / 7%);
  border-bottom: 1px solid rgb(0 0 0 / 7%);
  background: var(--map-fill, #fff);
  text-align: right;
  overflow-wrap: anywhere;
}
.tune-sheet thead th:first-child { width: 6%; }
.tune-sheet .tune-sheet-boundary { background: #a6a6a6; width: 6%; }
#tuning-calculator.tune-sheet table input {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 2px 1px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: right;
}
#tuning-calculator.tune-sheet table input:focus {
  position: relative;
  z-index: 1;
  outline: 2px solid #197346;
  outline-offset: -2px;
}
#tune-source-grid th:has(input), #tune-source-grid td:has(input) { padding: 0; }
#tune-source-grid thead th:first-child input::placeholder { color: #385843; font-size: .9em; text-align: center; }
#tune-result-grid td { white-space: nowrap; }
#tune-result-grid [data-edge]::after {
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-top: 4px solid #36432f;
  border-left: 4px solid transparent;
  content: '';
}
.tune-paste-box { margin: 10px 0; }
.tune-paste-box button { margin-top: 6px; }
.tune-sheet-toolbar { margin: 10px 0 6px; }
.tune-sheet-toolbar button { min-height: 34px; padding: 6px 10px; font-size: 12px; }
.tune-sheet-axes { margin: 6px 0 10px; }
.tune-sheet-axes summary { width: max-content; padding: 3px 6px; background: #fff; cursor: pointer; }
.tune-sheet-axes[open] { padding: 8px; background: #fff; }
#tuning-calculator .tune-sheet-axes .tune-inputs { margin: 8px 0; }
#tuning-calculator .tune-precision { width: max-content; }
#tune-map-status:not(:empty) { width: fit-content; padding: 3px 6px; background: #fff; }
.pops-page { display: grid; gap: 20px; }
.pops-page img { display: block; max-width: 100%; height: auto; }
.pops-meme { width: min(100%, 520px); margin-inline: auto; border-radius: 6px; }
.pops-page figure { margin: 15px 0; }
.pops-page figure img { width: 100%; border: 1px solid var(--line); }
.pops-page figcaption { margin-top: 6px; }
@media (max-width: 680px) {
  .tune-sheet { padding: 8px; }
}
