:root {
  color-scheme: dark;
  --ink: #f6f8f1;
  --body: #bfc7bd;
  --paper: #141714;
  --white: #1d221e;
  --line: #374138;
  --lime: #c8fb56;
  --sidebar: clamp(208px, 17vw, 268px);
  --gutter: clamp(24px, 4.5vw, 76px);
  --display: 'DM Sans', 'Microsoft JhengHei', 'Yu Gothic', system-ui, sans-serif;
  --reading: 0;
  scroll-padding-top: 20px;
}

h1, h2, .school-body h3, .detail-group h3 {
  font-family: var(--display);
  font-weight: 650;
}

em, .eyebrow, .text-link, .text-link:hover, .source {
  color: var(--lime);
}

a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, summary:focus-visible {
  outline-color: var(--lime);
  outline-offset: 3px;
}

.skip {
  background: var(--lime);
  color: #19210f;
}

.wrap {
  width: min(1320px, calc(100% - 2 * var(--gutter)));
}

.wrap.narrow {
  width: min(840px, calc(100% - 2 * var(--gutter)));
}

.reading-progress {
  position: fixed;
  top: 0;
  right: 0;
  left: var(--sidebar);
  z-index: 40;
  height: 3px;
  background: var(--lime);
  transform: scaleX(var(--reading));
  transform-origin: left;
  pointer-events: none;
}

.header {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  z-index: 30;
  background: #191d19;
  border: 0;
  border-right: 1px solid var(--line);
  backdrop-filter: none;
}

.header-inner {
  display: flex;
  flex-flow: column nowrap;
  align-items: stretch;
  width: 100%;
  height: 100%;
  min-height: 0;
  gap: clamp(18px, 5vh, 46px);
  padding: clamp(18px, 3vw, 34px) clamp(15px, 1.8vw, 26px);
  overflow-y: auto;
}

.brand {
  min-width: 0;
  font: 700 18px/1.25 var(--display);
}

.brand-mark {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 1px solid #53653a;
  border-radius: 9px;
  color: var(--lime);
  background: #22291e;
  font-size: 23px;
}

.brand small {
  margin-top: 4px;
  color: var(--body);
  letter-spacing: .085em;
  font-size: 8px;
}

.header nav,
html[data-locale=ja] .header nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
  width: 100%;
  margin: 0;
  padding: 0;
  order: 0;
  font-size: 13px;
}

.header nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 9px 11px;
  color: var(--body);
  border: 1px solid transparent;
  border-radius: 8px;
}

.header nav a:hover,
.header nav a[aria-current] {
  color: var(--lime);
  border-color: #435233;
  background: #262e22;
}

.header-tools {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 13px;
  margin: auto 0 0;
  padding: 17px 0 0;
  border-top: 1px solid var(--line);
}

.languages {
  display: flex;
  align-items: center;
  gap: 5px;
}

.languages a {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border-radius: 6px;
  color: var(--body);
  opacity: 1;
}

.languages a:hover, .languages a[aria-current] {
  color: var(--lime);
  background: #262e22;
  text-decoration: none;
}

.button, .exam-section .button {
  min-height: 44px;
  gap: 14px;
  border: 1px solid var(--lime);
  border-radius: 8px;
  background: var(--lime);
  color: #19210f;
  font-weight: 750;
  text-align: center;
}

.button:hover, .exam-section .button:hover {
  background: #d9ff8c;
}

.button.small, .header .button {
  padding: 9px 10px;
  font-size: 12px;
}

.button.secondary {
  color: var(--ink);
  background: #181e18d9;
  border-color: #758272;
}

.button.secondary:hover {
  background: #2f392d;
}

body > main, body > footer {
  margin-left: var(--sidebar);
}

body > .footer {
  margin-left: max(calc(var(--sidebar) + var(--gutter)), calc((100% + var(--sidebar) - 1320px) / 2));
  margin-right: auto;
  width: min(1320px, calc(100% - var(--sidebar) - 2 * var(--gutter)));
}

.hero {
  display: block;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 0;
  background: #181d18;
}

.hero-image {
  position: absolute;
  inset: 0;
  max-width: none;
  padding: 0;
  z-index: -1;
}

.hero-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 66% 52%;
  transform: scale(calc(1 + var(--hero-drift, 0) * .055));
}

.hero-image::after {
  position: absolute;
  inset: 0;
  content: '';
  background: linear-gradient(90deg, #121813 0%, #121813ef 20%, #121813ac 42%, #12181320 70%),
    linear-gradient(0deg, #141714 0%, transparent 30%);
}

.hero-content {
  display: grid;
  align-content: center;
  min-height: clamp(600px, 86svh, 850px);
  padding: clamp(46px, 8vh, 82px) 0 29px;
}

.hero-copy {
  width: min(100%, 670px);
  padding: 0;
}

.hero .eyebrow {
  margin-bottom: 20px;
  font-size: 11px;
  letter-spacing: .14em;
}

.hero h1 {
  max-width: 100%;
  font-size: clamp(43px, 5.3vw, 84px);
  line-height: 1.01;
  letter-spacing: -.064em;
  text-wrap: balance;
}

html[data-locale=zh] .hero h1,
html[data-locale=ja] .hero h1 {
  font-size: clamp(38px, 4.5vw, 68px);
  line-height: 1.23;
  letter-spacing: -.042em;
}

.hero h1 em {
  font-style: normal;
}

.hero .lead {
  max-width: 465px;
  color: #e0e6da;
  font-size: clamp(15px, 1.4vw, 18px);
}

.hero .hero-note {
  margin-top: 17px;
  color: #d4ded0;
  font-size: 12px;
}

.scroll-note {
  width: fit-content;
  margin-top: clamp(27px, 8vh, 75px);
  padding: 0;
  border: 0;
  color: var(--ink);
  font-size: 12px;
  letter-spacing: .06em;
}

.scroll-note:hover {
  color: var(--lime);
}

.section {
  padding-block: clamp(55px, 7vw, 103px);
}

.section-head {
  align-items: end;
  gap: 22px;
  margin-bottom: 30px;
}

.section-head h2, .money-layout h2 {
  font-size: clamp(30px, 3.4vw, 53px);
}

.starting-grid {
  gap: 14px;
  border: 0;
}

.start-item, .start-item + .start-item {
  display: flex;
  flex-direction: column;
  align-items: start;
  padding: clamp(19px, 2.4vw, 33px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(155deg, #252e25, var(--white) 80%);
}

.start-item:hover {
  border-color: #839d50;
}

.start-item, .school-card, .save-school, .detail-links a {
  transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.school-card:hover, .school-card:focus-within {
  border-color: #687c4d;
}

.school-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.save-school, .back-to-top {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #5e6e53;
  border-radius: 9px;
  background: #242d22;
  color: var(--lime);
  font: 23px/1 system-ui, sans-serif;
}

.save-school:hover, .back-to-top:hover {
  border-color: var(--lime);
}

.save-school span::before { content: '☆'; }
.save-school[aria-pressed="true"] span::before { content: '★'; }
.save-school[aria-pressed="true"] {
  background: var(--lime);
  border-color: var(--lime);
  color: #19210f;
}

.directory-controls { margin-top: 15px; }
.saved-filter {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
}
.saved-filter:has(input:checked) { border-color: var(--lime); }
.saved-filter input { margin: 0; accent-color: var(--lime); }
#saved-count { color: var(--lime); }

.detail-hero > .save-school {
  float: right;
  margin: 12px 0 8px 14px;
}

.detail-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.detail-links a {
  display: grid;
  align-items: center;
  min-height: 42px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--lime);
  font-size: 13px;
}
.detail-links a:hover { background: #2b3527; }
.detail-section:target, .detail-section h2:target { color: var(--lime); }

.gate-preview {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  cursor: zoom-in;
}
.gate-preview:focus-visible { outline-offset: -4px; }
.gate-preview span {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: #191e19ea;
  border: 1px solid #71826a;
  border-radius: 9px;
  color: var(--lime);
  font-size: 22px;
}
.gate-preview:hover span { background: #384732; }
.school-media-detail .school-media-emblem { pointer-events: none; }

.back-to-top {
  position: fixed;
  z-index: 20;
  bottom: max(16px, env(safe-area-inset-bottom));
  right: max(16px, env(safe-area-inset-right));
  box-shadow: 0 3px 14px #0006;
}
.back-to-top[hidden] { display: none; }

@media (prefers-reduced-motion: no-preference) {
  .enter-view { animation: section-enter .38s ease-out both; }
  @keyframes section-enter {
    from { opacity: .72; transform: translateY(7px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

.start-item p {
  min-height: 0;
}

.start-item .text-link {
  margin-top: auto;
}

.text-link {
  border-color: #61773b;
}

.service-section, .exam-section {
  border-block: 1px solid var(--line);
  background: #191f19;
  color: var(--ink);
}

.service-layout, .money-layout {
  gap: clamp(25px, 6vw, 100px);
}

.service-list article, .service-list article:first-child {
  border-color: var(--line);
}

.school-card {
  border-radius: 14px;
}

.school-body h3 {
  font-size: clamp(19px, 2vw, 27px);
  overflow-wrap: anywhere;
}

.school-media-frame {
  background: #252d25;
}

.school-card .school-media-frame {
  display: block;
}

.school-media-detail .school-media-frame {
  display: block;
}

.school-media-frame:has(.school-media-emblem:only-child) {
  display: grid;
}

.money-layout, .faq-section {
  padding-top: 0;
}

.budget-panel, .filters, .contact-box, .empty, .detail-group, .notice {
  background: var(--white);
  border-color: var(--line);
  border-radius: 12px;
}

.budget-panel {
  border: 1px solid var(--line);
}

.budget-glyph, .exam-name, .steps article > span, .faqs summary::after, .detail-group dt {
  color: var(--lime);
}

.budget-glyph {
  font-size: 68px;
}

.budget-panel li, .exam-grid article, .steps article {
  border-color: var(--line);
}

.exam-grid article {
  flex-wrap: wrap;
  gap: 15px;
}

.exam-grid article > div {
  flex: 1 1 185px;
}

.consult-strip {
  background: radial-gradient(ellipse at 100% 0, #344424, #212a20 60%);
  border: 1px solid #536241;
  border-radius: 15px;
}

.footer-right > a:hover {
  color: var(--lime);
}

.filters input, .filters select {
  background: #141a15;
  border-color: #566555;
}

.filters input::placeholder {
  color: var(--body);
  opacity: 1;
}

.notice {
  color: var(--body);
  border-left-color: #809b4b;
}

@media (min-width: 901px) and (max-width: 1200px) {
  .school-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  :root {
    --sidebar: 0px;
    scroll-padding-top: 108px;
  }

  .header {
    position: sticky;
    inset: 0 0 auto;
    width: auto;
    background: #191d19f5;
    border: 0;
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(15px);
  }

  .header-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    min-height: 67px;
    gap: 10px;
    padding: 9px var(--gutter);
    overflow: visible;
  }

  .header nav,
  html[data-locale=ja] .header nav {
    display: none;
    position: absolute;
    inset: 100% var(--gutter) auto;
    width: auto;
    max-height: min(380px, 70dvh);
    overflow: auto;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: 0 0 12px 12px;
    background: #191d19;
    box-shadow: 0 15px 28px #0006;
  }

  .header nav.open {
    display: grid;
  }

  .header-tools {
    grid-column: 2;
    grid-row: 1;
    width: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    margin: 0;
    padding: 0;
    border: 0;
  }

  .menu-toggle {
    position: relative;
    display: grid;
    place-items: center;
    grid-column: 3;
    grid-row: 1;
    width: 44px;
    height: 44px;
    padding: 0;
    margin: 0;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
  }

  .menu-toggle span,
  .menu-toggle::before,
  .menu-toggle::after {
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
  }

  .menu-toggle::before,
  .menu-toggle::after {
    position: absolute;
    content: '';
  }

  .menu-toggle::before { transform: translateY(-6px); }
  .menu-toggle::after { transform: translateY(6px); }
  .menu-toggle[aria-expanded="true"] span { visibility: hidden; }
  .menu-toggle[aria-expanded="true"]::before { transform: rotate(45deg); }
  .menu-toggle[aria-expanded="true"]::after { transform: rotate(-45deg); }

  .hero-content {
    min-height: 585px;
  }

  .hero h1 {
    font-size: clamp(40px, 6.5vw, 60px);
  }
}

@media (max-width: 650px) {
  :root {
    --gutter: 18px;
  }

  .header-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 12px;
  }

  .menu-toggle {
    grid-column: 2;
  }

  .header-tools {
    grid-column: 1 / -1;
    grid-row: 2;
    border-top: 1px solid var(--line);
    padding-top: 6px;
  }

  .header-tools .button {
    min-height: 35px;
    padding-block: 6px;
  }

  .hero-image {
    position: relative;
    aspect-ratio: 16 / 8;
    width: 100%;
  }

  .hero-image::after {
    background: linear-gradient(0deg, #181d18, #181d1800 45%);
  }

  .hero-content {
    min-height: 0;
    padding-top: 0;
    margin-top: -10px;
  }

  .hero-copy {
    position: relative;
  }

  .hero h1 {
    margin-bottom: 19px;
    font-size: clamp(34px, 9.4vw, 54px);
  }

  html[data-locale=zh] .hero h1,
  html[data-locale=ja] .hero h1 {
    font-size: clamp(30px, 8vw, 49px);
  }

  .hero .eyebrow {
    margin-bottom: 12px;
  }

  .hero .actions {
    margin-top: 18px;
  }

  .scroll-note {
    margin-top: 18px;
  }

  .steps {
    gap: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root { scroll-behavior: auto; }
  .hero-image img, .button:hover { transform: none; }
  .button { transition: none; }
}
