:root {
  color-scheme: light;
  --ink: #16251f;
  --muted: #637068;
  --paper: #f7f1e3;
  --paper-deep: #eadfca;
  --board: #173c34;
  --board-dark: #0f2e28;
  --chalk: #eff5e9;
  --blue: #315f85;
  --blue-light: #dce8f0;
  --yellow: #e5b83f;
  --yellow-light: #f8edc5;
  --red: #b84c3e;
  --red-light: #f2d7d0;
  --line: #c9bea8;
  --white: #fffdf8;
  font-family:
    "Yu Gothic UI",
    "Hiragino Sans",
    Meiryo,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  font-synthesis: none;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background-color: var(--paper);
}

button,
input,
select {
  color: inherit;
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 0.6rem;
  left: 0.6rem;
  padding: 0.55rem 0.8rem;
  color: white;
  background: var(--board-dark);
  border-radius: 0.35rem;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 2rem));
  min-height: 72px;
  margin: 0 auto;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  display: inline-flex;
  gap: 0.72rem;
  align-items: center;
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.school-mark {
  position: relative;
  display: inline-flex;
  gap: 2px;
  align-items: end;
  justify-content: center;
  width: 35px;
  height: 31px;
  padding: 8px 5px 4px;
  background: var(--board);
  border: 2px solid var(--ink);
  border-radius: 3px 3px 1px 1px;
}

.school-mark::before {
  position: absolute;
  top: -7px;
  width: 25px;
  height: 9px;
  content: "";
  background: var(--red);
  border: 2px solid var(--ink);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.school-mark i {
  display: block;
  width: 5px;
  height: 8px;
  background: var(--yellow-light);
  border-radius: 1px;
}

.site-header nav,
.site-footer span:last-child {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

.site-header nav a,
.site-footer a {
  color: #415149;
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
}

.site-header nav a:hover,
.site-header nav a:focus-visible,
.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--red);
  text-decoration: underline;
  text-underline-offset: 0.25rem;
}

.home,
.content-page,
.not-found {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
}

.campus-intro {
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(390px, 1.12fr);
  gap: clamp(2rem, 5vw, 5.5rem);
  align-items: center;
  min-height: 500px;
  padding: 4.2rem 0 4.8rem;
}

.product-heading {
  max-width: 520px;
}

.eyebrow,
.section-heading p,
.desk-heading p,
.result-heading p,
.code-tray header p,
.content-heading p {
  margin: 0 0 0.55rem;
  color: var(--red);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.product-heading h1 {
  max-width: 12em;
  margin: 0;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(2.05rem, 4vw, 3.45rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.25;
}

.product-heading > p:not(.eyebrow) {
  max-width: 35rem;
  margin: 1.25rem 0 0;
  color: #4e5d55;
  font-size: 1rem;
}

.directory-facts {
  display: flex;
  gap: 0;
  margin-top: 2rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.directory-facts span {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 0.8rem 1rem 0.75rem 0;
}

.directory-facts span + span {
  padding-left: 1rem;
  border-left: 1px solid var(--line);
}

.directory-facts strong {
  font-family: Georgia, serif;
  font-size: 1.45rem;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.directory-facts small {
  color: var(--muted);
  font-size: 0.72rem;
}

.campus-cabinet {
  position: relative;
  min-height: 345px;
  padding: 2.2rem;
  overflow: hidden;
  background: var(--board);
  border: 8px solid #795d3c;
  border-radius: 0.5rem;
  box-shadow:
    0 18px 45px rgb(38 34 23 / 14%),
    inset 0 0 0 2px #ae8b5d;
}

.campus-cabinet::before,
.campus-cabinet::after {
  position: absolute;
  content: "";
  opacity: 0.28;
}

.campus-cabinet::before {
  inset: 1.1rem 1.2rem auto;
  height: 1px;
  background: var(--chalk);
}

.campus-cabinet::after {
  right: 1.2rem;
  bottom: 0.8rem;
  width: 8rem;
  height: 0.4rem;
  background: #d6cdb7;
  border-radius: 999px;
  box-shadow: -4rem -0.2rem 0 -0.11rem #c77b68;
}

.school-row {
  display: grid;
  grid-template-columns: 0.9fr 1fr 1.14fr;
  gap: 1rem;
  align-items: end;
  min-height: 155px;
  padding: 1rem 1rem 0;
  border-bottom: 7px solid #bd9363;
}

.school-block {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 105px;
  background: #e4d8bc;
  border: 3px solid #102c26;
  box-shadow: 7px 7px 0 rgb(7 31 26 / 30%);
}

.school-block.primary {
  min-height: 95px;
  background: #f0c957;
}

.school-block.high {
  min-height: 125px;
  background: #d6e2e8;
}

.school-block.university {
  min-height: 145px;
  background: #e9ded0;
}

.school-block .roof {
  position: absolute;
  top: -24px;
  width: calc(100% + 12px);
  height: 27px;
  background: var(--red);
  border: 3px solid #102c26;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.school-block .clock {
  position: absolute;
  top: 14px;
  color: var(--red);
  font-size: 0.75rem;
  font-style: normal;
}

.school-block .pillars {
  position: absolute;
  inset: 30px 18px 15px;
  border-top: 9px solid var(--blue);
  border-bottom: 9px solid var(--blue);
  background: var(--blue);
  clip-path: polygon(
    0 0,
    100% 0,
    100% 18%,
    88% 18%,
    88% 82%,
    72% 82%,
    72% 18%,
    59% 18%,
    59% 82%,
    43% 82%,
    43% 18%,
    30% 18%,
    30% 82%,
    14% 82%,
    14% 18%,
    0 18%
  );
}

.school-block b {
  position: relative;
  z-index: 1;
  color: var(--board-dark);
  font-family: "Yu Mincho", serif;
  font-size: 1.45rem;
}

.school-block.university b {
  color: var(--white);
}

.school-block em {
  position: absolute;
  right: 7px;
  bottom: 6px;
  padding: 0.08rem 0.28rem;
  color: white;
  background: var(--red);
  font-family: ui-monospace, monospace;
  font-size: 0.65rem;
  font-style: normal;
}

.code-drawer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.8rem;
  align-items: center;
  margin: 1.55rem 0 1.1rem;
  padding: 0.75rem 0.9rem;
  color: var(--ink);
  background: var(--white);
  border: 2px solid var(--ink);
  box-shadow: 5px 5px 0 rgb(7 31 26 / 28%);
}

.code-drawer span {
  padding-right: 0.75rem;
  border-right: 1px solid var(--line);
  font-size: 0.7rem;
  font-weight: 800;
}

.code-drawer strong {
  overflow: hidden;
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: clamp(0.9rem, 2vw, 1.15rem);
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
}

.code-drawer i {
  display: grid;
  width: 1.8rem;
  height: 1.8rem;
  place-items: center;
  color: white;
  background: var(--blue);
  font-size: 0.7rem;
  font-style: normal;
}

.index-tabs {
  display: flex;
  gap: 0.45rem;
  justify-content: center;
}

.index-tabs span {
  padding: 0.28rem 0.65rem;
  color: var(--board-dark);
  background: var(--yellow-light);
  border-bottom: 3px solid var(--yellow);
  font-size: 0.68rem;
  font-weight: 800;
}

.version-ribbon {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1.25rem;
  align-items: center;
  padding: 0.85rem 1.15rem;
  color: #523b00;
  background: var(--yellow-light);
  border: 1px solid #d8bc69;
  border-left: 5px solid var(--yellow);
}

.version-ribbon strong {
  font-size: 0.82rem;
}

.version-ribbon span,
.version-ribbon a {
  font-size: 0.76rem;
}

.version-ribbon a {
  font-weight: 800;
}

.prefecture-deck,
.directory-workspace {
  scroll-margin-top: 1rem;
}

.prefecture-deck {
  padding: 5rem 0 3.5rem;
}

.section-heading,
.result-heading,
.code-tray > header,
.desk-heading {
  display: flex;
  gap: 1rem;
  align-items: end;
  justify-content: space-between;
}

.section-heading h2,
.result-heading h2,
.code-tray h2,
.desk-heading h2 {
  margin: 0;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(1.45rem, 2.5vw, 2.05rem);
  line-height: 1.25;
}

.section-heading output,
.result-heading output,
.code-tray output {
  color: var(--board);
  font-family: Georgia, serif;
  font-size: 0.9rem;
  font-weight: 700;
}

.code-hint {
  margin: 1rem 0 1.4rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.region-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.8rem;
}

.region-card {
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: 3px 4px 0 rgb(94 77 46 / 8%);
}

.region-card h3 {
  margin: 0;
  padding: 0.5rem 0.7rem;
  color: var(--chalk);
  background: var(--board);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
}

.region-card > div {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  padding: 0.35rem;
}

.region-card button {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  justify-content: space-between;
  min-height: 39px;
  padding: 0.35rem 0.45rem;
  background: transparent;
  border: 0;
  border-radius: 0.2rem;
  font-size: 0.78rem;
  text-align: left;
}

.region-card button:hover,
.region-card button:focus-visible {
  color: white;
  background: var(--blue);
  outline: none;
}

.region-card button small {
  color: var(--muted);
  font-family: Georgia, serif;
  font-size: 0.61rem;
}

.region-card button:hover small,
.region-card button:focus-visible small {
  color: white;
}

.direct-code {
  display: grid;
  grid-template-columns: 9rem minmax(250px, 420px) 1fr;
  gap: 1rem;
  align-items: center;
  margin-top: 1.25rem;
  padding: 1rem 1.1rem;
  background: #e8dfcd;
  border: 1px solid var(--line);
}

.direct-code > span:first-child {
  font-size: 0.76rem;
  font-weight: 900;
}

.direct-code > span:nth-child(2) {
  display: grid;
  grid-template-columns: 1fr auto;
}

.direct-code input {
  min-width: 0;
  padding: 0.6rem 0.75rem;
  background: var(--white);
  border: 2px solid var(--board);
  border-right: 0;
  border-radius: 0.25rem 0 0 0.25rem;
  font-family: ui-monospace, "Cascadia Mono", monospace;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.direct-code button {
  padding: 0.55rem 1rem;
  color: white;
  background: var(--board);
  border: 2px solid var(--board);
  border-radius: 0 0.25rem 0.25rem 0;
  font-size: 0.8rem;
  font-weight: 800;
}

.direct-code small {
  color: var(--muted);
  font-size: 0.72rem;
}

.directory-workspace {
  padding: 1.5rem 0 5rem;
}

.search-desk {
  padding: clamp(1.1rem, 3vw, 2rem);
  background: var(--board);
  border: 7px solid #795d3c;
  box-shadow:
    0 15px 38px rgb(44 36 22 / 13%),
    inset 0 0 0 2px #a27c4d;
}

.desk-heading {
  color: var(--chalk);
}

.desk-heading p {
  color: #f3d67d;
}

.desk-heading button,
.desk-actions button {
  padding: 0.45rem 0.75rem;
  color: var(--chalk);
  background: transparent;
  border: 1px solid rgb(239 245 233 / 45%);
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 800;
}

.selected-prefecture {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.8rem;
  align-items: center;
  margin: 1.4rem 0;
  padding-bottom: 0.8rem;
  color: var(--chalk);
  border-bottom: 1px solid rgb(239 245 233 / 28%);
}

.selected-prefecture > span {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  color: var(--board-dark);
  background: var(--yellow);
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  font-weight: 900;
}

.selected-prefecture strong {
  font-family: "Yu Mincho", serif;
  font-size: 1.35rem;
}

.selected-prefecture output {
  font-family: Georgia, serif;
  font-size: 0.85rem;
}

.school-search {
  display: grid;
  gap: 0.45rem;
  color: var(--chalk);
  font-size: 0.76rem;
  font-weight: 800;
}

.search-box {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  color: var(--ink);
  background: var(--white);
  border: 3px solid #0b2822;
}

.search-box i {
  padding-left: 0.85rem;
  color: var(--blue);
  font-size: 1.3rem;
  font-style: normal;
}

.search-box input {
  width: 100%;
  padding: 0.85rem 0.9rem;
  background: transparent;
  border: 0;
  outline: 0;
}

.search-box:focus-within {
  box-shadow: 0 0 0 3px var(--yellow);
}

.filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.25fr;
  gap: 1rem;
  align-items: end;
  margin-top: 1rem;
}

.filter-grid > label {
  display: grid;
  gap: 0.35rem;
  color: var(--chalk);
  font-size: 0.72rem;
  font-weight: 800;
}

.filter-grid select {
  width: 100%;
  min-height: 43px;
  padding: 0.55rem 2rem 0.55rem 0.65rem;
  color: var(--ink);
  background: var(--white);
  border: 2px solid #0b2822;
  border-radius: 0.2rem;
}

.status-filter {
  margin: 0;
  padding: 0;
  color: var(--chalk);
  border: 0;
}

.status-filter legend {
  margin-bottom: 0.35rem;
  font-size: 0.72rem;
  font-weight: 800;
}

.status-filter > div {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.status-filter button {
  min-height: 43px;
  color: var(--chalk);
  background: #244e44;
  border: 1px solid #6f8a82;
  font-size: 0.78rem;
  font-weight: 800;
}

.status-filter button + button {
  border-left: 0;
}

.status-filter button[aria-pressed="true"] {
  color: var(--board-dark);
  background: var(--yellow);
  border-color: var(--yellow);
}

.desk-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 1rem;
  color: #c6d5cf;
}

.desk-actions small {
  font-size: 0.68rem;
}

#search-status {
  min-height: 1.5em;
  margin: 0.75rem 0 0;
  color: #e9dcae;
  font-size: 0.72rem;
}

.result-and-tray {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 1.5rem;
  align-items: start;
  margin-top: 2rem;
}

.school-results {
  min-width: 0;
}

.result-heading,
.code-tray > header {
  padding-bottom: 0.8rem;
  border-bottom: 2px solid var(--ink);
}

.school-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.school-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 1rem;
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 5px solid var(--blue);
  box-shadow: 4px 5px 0 rgb(90 72 40 / 8%);
}

.school-card.is-closed {
  border-top-color: var(--red);
  background: #fbf4f0;
}

.card-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.card-tabs span {
  padding: 0.16rem 0.42rem;
  font-size: 0.61rem;
  font-weight: 800;
}

.type-tab {
  color: #173c5b;
  background: var(--blue-light);
}

.owner-tab {
  color: #5d4709;
  background: var(--yellow-light);
}

.state-tab.active {
  color: #185344;
  background: #d9eee4;
}

.state-tab.closed {
  color: #7d3027;
  background: var(--red-light);
}

.code-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: center;
  margin: 0.85rem 0 0.65rem;
  padding: 0.52rem 0.6rem;
  background: #f1eadc;
  border-left: 4px solid var(--board);
}

.school-code {
  overflow: hidden;
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.035em;
  text-overflow: ellipsis;
}

.copy-code {
  padding: 0.24rem 0.45rem;
  color: var(--board);
  background: transparent;
  border: 1px solid var(--board);
  border-radius: 0.2rem;
  font-size: 0.6rem;
  font-weight: 800;
}

.school-name {
  margin: 0.2rem 0 0.45rem;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 1.08rem;
  line-height: 1.45;
}

.school-address {
  display: grid;
  gap: 0.15rem;
  margin: 0;
  color: #4e5d55;
  font-size: 0.75rem;
}

.postal {
  color: var(--muted);
  font-family: ui-monospace, monospace;
  font-size: 0.66rem;
}

.school-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.75rem;
  margin: 0.8rem 0;
  padding-top: 0.7rem;
  border-top: 1px dashed var(--line);
  font-size: 0.68rem;
}

.school-facts dt {
  color: var(--muted);
}

.school-facts dd {
  margin: 0;
  text-align: right;
}

.migration-list {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
}

.migration-link {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 0.5rem;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 0.55rem 0.65rem;
  color: #6f2b23;
  background: var(--red-light);
  border: 1px solid #d3a49c;
  text-align: left;
}

.migration-link span {
  grid-column: 1 / -1;
  font-size: 0.59rem;
  font-weight: 800;
}

.migration-link code {
  font-size: 0.72rem;
  font-weight: 800;
}

.migration-link b {
  font-size: 0.63rem;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  margin-top: auto;
}

.card-actions button {
  min-height: 37px;
  padding: 0.42rem 0.58rem;
  border-radius: 0.2rem;
  font-size: 0.68rem;
  font-weight: 900;
}

.copy-record {
  color: white;
  background: var(--board);
  border: 1px solid var(--board);
}

.save-record {
  color: var(--board);
  background: var(--yellow-light);
  border: 1px solid #d8b759;
}

.save-record:disabled {
  cursor: default;
  opacity: 0.58;
}

.load-more {
  display: block;
  width: min(330px, 100%);
  margin: 1.25rem auto 0;
  padding: 0.7rem 1rem;
  color: white;
  background: var(--blue);
  border: 0;
  border-radius: 0.2rem;
  font-size: 0.78rem;
  font-weight: 900;
}

.code-tray {
  position: sticky;
  top: 1rem;
  padding: 1rem;
  background: #e7dbc5;
  border: 1px solid #baaa8b;
  box-shadow: 5px 6px 0 rgb(90 72 40 / 9%);
}

#saved-items {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

.tray-empty,
.loading-note,
.empty-result {
  margin: 0;
  padding: 1rem;
  color: var(--muted);
  background: rgb(255 253 248 / 72%);
  border: 1px dashed var(--line);
  font-size: 0.74rem;
}

.school-grid > .loading-note,
.school-grid > .empty-result {
  grid-column: 1 / -1;
}

.saved-school {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.6rem;
  align-items: center;
  padding: 0.55rem;
  background: var(--white);
  border: 1px solid var(--line);
}

.saved-number {
  color: var(--red);
  font-family: Georgia, serif;
  font-size: 0.7rem;
}

.saved-school div {
  display: grid;
  min-width: 0;
}

.saved-school strong {
  overflow: hidden;
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-school code {
  color: var(--muted);
  font-size: 0.58rem;
}

.saved-item-actions {
  display: flex;
  gap: 0.25rem;
}

.saved-item-actions button {
  padding: 0.2rem 0.35rem;
  background: transparent;
  border: 1px solid var(--line);
  font-size: 0.58rem;
}

.open-saved {
  color: var(--blue);
}

.remove-saved {
  color: var(--red);
}

.saved-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

.saved-actions button {
  padding: 0.55rem;
  color: white;
  background: var(--board);
  border: 1px solid var(--board);
  border-radius: 0.2rem;
  font-size: 0.68rem;
  font-weight: 900;
}

.saved-actions .clear-button {
  color: var(--red);
  background: transparent;
  border-color: #c69a8f;
}

.saved-actions button:disabled {
  cursor: default;
  opacity: 0.45;
}

.content-page {
  min-height: calc(100vh - 145px);
  padding: 4.2rem 0 5rem;
}

.content-heading {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.25rem;
  align-items: center;
  max-width: 800px;
  margin-bottom: 2.4rem;
}

.page-index {
  display: grid;
  width: 4.2rem;
  height: 4.2rem;
  place-items: center;
  color: var(--chalk);
  background: var(--board);
  border: 5px solid #795d3c;
  font-family: "Yu Mincho", serif;
  font-size: 1.55rem;
}

.content-heading h1 {
  margin: 0;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(1.85rem, 4vw, 3rem);
  letter-spacing: -0.035em;
  line-height: 1.3;
}

.instruction-grid,
.definition-grid,
.source-grid,
.privacy-grid {
  display: grid;
  gap: 1rem;
}

.instruction-grid {
  grid-template-columns: repeat(3, 1fr);
}

.definition-grid,
.privacy-grid {
  grid-template-columns: repeat(2, 1fr);
}

.source-grid {
  grid-template-columns: repeat(2, 1fr);
}

.instruction-grid section,
.definition-grid section,
.source-grid section,
.privacy-grid section {
  position: relative;
  padding: 1.4rem;
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 4px solid var(--blue);
  box-shadow: 4px 5px 0 rgb(90 72 40 / 8%);
}

.instruction-grid section > b {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: grid;
  width: 1.9rem;
  height: 1.9rem;
  place-items: center;
  color: var(--board-dark);
  background: var(--yellow);
  font-family: "Yu Mincho", serif;
}

.instruction-grid h2,
.definition-grid h2,
.source-grid h2,
.privacy-grid h2 {
  margin: 0 0 0.55rem;
  font-family: "Yu Mincho", serif;
  font-size: 1.08rem;
}

.instruction-grid p,
.definition-grid p,
.source-grid p,
.privacy-grid p,
.care-note p {
  margin: 0;
  color: #4f5c55;
  font-size: 0.82rem;
}

.source-grid a {
  color: var(--blue);
  font-weight: 800;
  text-underline-offset: 0.2rem;
}

.definition-mark {
  display: grid;
  width: 2.4rem;
  height: 2.4rem;
  margin-bottom: 0.8rem;
  place-items: center;
  color: white;
  font-weight: 900;
}

.definition-mark.active {
  background: var(--board);
}

.definition-mark.closed {
  background: var(--red);
}

.care-note {
  margin-top: 1.2rem;
  padding: 1rem 1.2rem;
  background: var(--yellow-light);
  border: 1px solid #d6bc6d;
  border-left: 5px solid var(--yellow);
}

.care-note strong {
  display: block;
  margin-bottom: 0.3rem;
  color: #593f00;
  font-size: 0.82rem;
}

.page-cta,
.not-found a {
  display: inline-block;
  margin-top: 1.6rem;
  padding: 0.7rem 1rem;
  color: white;
  background: var(--board);
  border-radius: 0.2rem;
  font-size: 0.8rem;
  font-weight: 900;
  text-decoration: none;
}

.not-found {
  display: grid;
  min-height: calc(100vh - 145px);
  place-content: center;
  justify-items: start;
}

.not-found > span {
  color: var(--red);
  font-family: Georgia, serif;
  font-size: 1rem;
  font-weight: 900;
}

.not-found h1 {
  margin: 0.25rem 0;
  font-family: "Yu Mincho", serif;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
}

.not-found p {
  color: var(--muted);
}

.site-footer {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 2rem));
  min-height: 72px;
  margin: 0 auto;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 0.68rem;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

@media (max-width: 980px) {
  .campus-intro {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }

  .region-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .result-and-tray {
    grid-template-columns: 1fr;
  }

  .code-tray {
    position: static;
  }
}

@media (max-width: 720px) {
  .site-header {
    min-height: 62px;
  }

  .site-header nav {
    gap: 0.7rem;
  }

  .site-header nav a {
    font-size: 0.7rem;
  }

  .campus-intro {
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 2.8rem 0 3rem;
  }

  .campus-cabinet {
    min-height: 310px;
    padding: 1.7rem;
  }

  .version-ribbon {
    grid-template-columns: 1fr auto;
  }

  .version-ribbon span {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .direct-code {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .filter-grid {
    grid-template-columns: 1fr 1fr;
  }

  .status-filter {
    grid-column: 1 / -1;
  }

  .school-grid {
    grid-template-columns: 1fr;
  }

  .instruction-grid,
  .source-grid {
    grid-template-columns: 1fr;
  }

  .definition-grid,
  .privacy-grid {
    grid-template-columns: 1fr;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 1rem 0;
  }
}

@media (max-width: 480px) {
  .home,
  .content-page,
  .not-found,
  .site-header,
  .site-footer {
    width: min(100% - 1.2rem, 1180px);
  }

  .wordmark {
    gap: 0.48rem;
    font-size: 0.82rem;
  }

  .school-mark {
    transform: scale(0.88);
  }

  .site-header nav a:nth-child(2) {
    display: none;
  }

  .product-heading h1 {
    font-size: 2rem;
  }

  .directory-facts strong {
    font-size: 1.16rem;
  }

  .campus-cabinet {
    min-height: 275px;
    padding: 1.3rem;
  }

  .school-row {
    gap: 0.45rem;
    min-height: 135px;
    padding: 0.7rem 0.25rem 0;
  }

  .school-block.primary {
    min-height: 80px;
  }

  .school-block.high {
    min-height: 100px;
  }

  .school-block.university {
    min-height: 120px;
  }

  .code-drawer {
    grid-template-columns: 1fr auto;
  }

  .code-drawer span {
    display: none;
  }

  .region-grid {
    grid-template-columns: 1fr;
  }

  .filter-grid {
    grid-template-columns: 1fr;
  }

  .status-filter {
    grid-column: auto;
  }

  .desk-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .card-actions {
    grid-template-columns: 1fr;
  }

  .saved-actions {
    grid-template-columns: 1fr;
  }

  .content-heading {
    grid-template-columns: 1fr;
  }

  .page-index {
    width: 3.2rem;
    height: 3.2rem;
    font-size: 1.2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
