:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #607184;
  --line: #d9e2eb;
  --panel: #fff;
  --soft: #f3f7fa;
  --accent: #087463;
  --accent-strong: #075c50;
  --warn: #a16207;
  --danger: #b91c1c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: #eef3f7;
  color: var(--ink);
  font-family: Inter, Pretendard, "Noto Sans KR", "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }

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

.app-header {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
  grid-template-areas:
    "title languages"
    "lead visitors"
    "lead release";
  column-gap: clamp(28px, 4vw, 72px);
  row-gap: 12px;
  align-items: start;
  padding: 48px clamp(24px, 5vw, 72px) 38px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.language-switcher {
  grid-area: languages;
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  justify-self: end;
  gap: 4px;
  max-width: 100%;
}

.lang-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 27px;
  min-height: 0;
  padding: 2px;
  border: 1px solid #c7d3df;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  line-height: 1;
}

.lang-button img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 2px;
  object-fit: contain;
}

.lang-button.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(8, 116, 99, .16);
}

.lang-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.visitor-counter {
  grid-area: visitors;
  justify-self: end;
  align-self: stretch;
  display: grid;
  align-content: center;
  gap: 7px;
  width: 220px;
  min-height: 64px;
  margin-top: -10px;
  padding: 12px 14px;
  border: 1px solid #dce6ef;
  border-radius: 6px;
  background: #fbfdff;
}

.visitor-counter__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.visitor-counter__row[hidden],
.visitor-country[hidden],
.usage-meter[hidden] {
  display: none;
}

.visitor-counter__row--private,
.visitor-country {
  padding-top: 7px;
  border-top: 1px solid #e5edf4;
}

.visitor-country__list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 6px;
  color: #102238;
  font-size: .7rem;
  font-weight: 800;
  line-height: 1.25;
}

.visitor-counter__label {
  display: block;
  color: #52677b;
  font-size: .68rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0;
}

.visitor-counter strong {
  color: #102238;
  font-size: 1.75rem;
  line-height: 1;
  letter-spacing: 0;
}

.visitor-counter__status {
  position: relative;
  display: block;
  margin-top: 0;
  padding-left: 12px;
  color: var(--accent);
  font-size: .66rem;
  font-weight: 800;
  line-height: 1;
}

.visitor-counter__status::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  transform: translateY(-50%);
}

.release-note {
  grid-area: release;
  justify-self: end;
  width: 220px;
  margin-top: -4px;
  color: #7a8998;
  font-size: .68rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: right;
  letter-spacing: 0;
}

.usage-meter {
  display: none;
}

h1 {
  grid-area: title;
  margin-bottom: 12px;
  font-size: clamp(2.15rem, 3.35vw, 3.45rem);
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 18px;
  font-size: 1.15rem;
}

.lead {
  grid-area: lead;
  display: flex;
  flex-wrap: wrap;
  gap: 0 .42em;
  max-width: 980px;
  margin: 0;
  color: #486073;
  font-size: .98rem;
  line-height: 1.65;
  white-space: normal;
  overflow-wrap: break-word;
}

.lead-sentence {
  white-space: nowrap;
}

html[lang="ne"] .lead-sentence,
html[lang="my"] .lead-sentence {
  white-space: normal;
}

.preview-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 24px;
  padding: 24px clamp(18px, 3vw, 36px) 56px;
}

.mobile-filter-toggle {
  display: none;
}

.panel,
.results-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.panel {
  padding: 22px;
}

.panel + .panel { margin-top: 16px; }

.muted-panel { background: #fbfdff; }

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.english-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #e7eef5;
}

.exam-filter,
.metadata-filter {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #e7eef5;
}

.exam-filter__head {
  margin-bottom: 10px;
  color: #25384d;
  font-size: .84rem;
  font-weight: 900;
}

.exam-filter__head.is-spaced {
  margin-top: 16px;
}

.exam-filter__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}

.exam-filter label,
.metadata-filter label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  color: #25384d;
  font-size: .82rem;
  font-weight: 800;
}

.exam-filter input,
.metadata-filter input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.exam-filter label span,
.metadata-filter label span {
  display: inline;
  margin-bottom: 0;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

label span {
  display: block;
  margin-bottom: 7px;
  color: #25384d;
  font-size: .84rem;
  font-weight: 900;
}

input,
select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #cbd8e5;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

input:focus,
select:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(8, 116, 99, .14);
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.filter-actions-bottom {
  display: none;
}

button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

button.secondary {
  border-color: #cbd8e5;
  background: #fff;
  color: #25384d;
}

.has-update-notice {
  overflow: hidden;
}

.update-notice[hidden] {
  display: none;
}

.update-notice {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(10, 24, 38, .42);
}

.update-notice__dialog {
  position: relative;
  width: min(620px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  border: 1px solid #cbd8e5;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(16, 34, 56, .22);
  padding: 28px;
}

.update-notice__close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 38px;
  min-height: 38px;
  padding: 0;
  border-color: #d7e2ec;
  background: #fff;
  color: #30465d;
  font-size: 1.35rem;
  line-height: 1;
}

.update-notice__languages {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 44px 16px 0;
}

.update-notice__languages .lang-button {
  flex: 0 0 auto;
  width: 34px;
  height: 25px;
}

.update-notice__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #e9f7f3;
  color: var(--accent);
  font-size: .78rem;
  font-weight: 900;
}

.update-notice__dialog h2 {
  margin: 0 44px 10px 0;
  color: var(--ink);
  font-size: clamp(1.45rem, 3vw, 2rem);
  line-height: 1.2;
}

.update-notice__intro,
.update-notice__note {
  color: #41566d;
  line-height: 1.65;
}

.update-notice__items {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.update-notice__item {
  border: 1px solid #dbe6f0;
  border-radius: 8px;
  background: #f7fafc;
  padding: 14px 16px;
}

.update-notice__item h3 {
  margin: 0 0 7px;
  color: #18314d;
  font-size: 1rem;
  line-height: 1.35;
}

.update-notice__item h3 span {
  color: #52677b;
  font-weight: 800;
}

.update-notice__item p {
  margin: 0;
  color: #3d5369;
  line-height: 1.6;
}

.update-notice__item--year {
  background: #fffaf0;
  border-color: #f3db9f;
}

.update-notice__university-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.update-notice__university-chip {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  align-items: baseline;
  gap: 6px;
  width: 100%;
  min-width: 0;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid #dbe6f0;
  border-radius: 7px;
  background: #fff;
  color: #18314d;
  font-size: .76rem;
  font-weight: 900;
}

.update-notice__university-chip span {
  min-width: 0;
  color: #52677b;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.update-notice__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

.stats-grid {
  display: grid;
  gap: 10px;
  margin: 0;
}

.stats-grid div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid #e7eef5;
}

.stats-grid dt {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
}

.stats-grid dd {
  margin: 0;
  color: var(--ink);
  font-size: .9rem;
  font-weight: 900;
}

.note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.55;
}

.results-panel {
  min-height: 620px;
  padding: 22px;
}

.results-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.results-head h2 { margin-bottom: 6px; }

.results-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: .9rem;
}

.query-box {
  width: min(320px, 40%);
}

.eligibility-results {
  display: grid;
  gap: 14px;
}

.university-group {
  border: 1px solid #cfdae6;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.university-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 66px;
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
}

.university-group summary::-webkit-details-marker {
  display: none;
}

.university-group summary::before {
  content: "▶";
  flex: 0 0 auto;
  color: var(--accent);
  font-size: .78rem;
  font-weight: 900;
  transition: transform .16s ease;
}

.university-group[open] summary::before {
  transform: rotate(90deg);
}

.university-group summary > div {
  min-width: 0;
  flex: 1 1 auto;
}

.university-group summary strong {
  display: block;
  color: #405870;
  font-size: 1.04rem;
  line-height: 1.35;
}

.university-group summary span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
}

.university-count {
  flex: 0 0 auto;
  margin-top: 0 !important;
  padding: 5px 9px;
  border-radius: 999px;
  background: #edf8f4;
  color: var(--accent-strong) !important;
  font-size: .78rem !important;
}

.university-group[open] summary {
  border-bottom: 1px solid #edf2f7;
}

.university-programs {
  display: grid;
  gap: 12px;
  padding: 12px;
  background: #f8fbfd;
}

.result-card {
  border: 1px solid #cfdae6;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.result-card__main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

.result-card h3 {
  margin: 0 0 12px;
  color: #405870;
  font-size: 1.05rem;
  line-height: 1.35;
}

.verification-pill {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-left: 6px;
  padding: 0 7px;
  border-radius: 999px;
  background: #eef6ff;
  color: #2563eb;
  font-size: .68rem;
  font-weight: 900;
  vertical-align: middle;
}

.admission-year-pill {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-left: 6px;
  padding: 0 7px;
  border-radius: 999px;
  background: #fff0c2;
  color: #92400e;
  font-size: .68rem;
  font-weight: 900;
  vertical-align: middle;
}

.program-meta-line .admission-year-pill {
  margin-left: 0;
}

.university-group summary .admission-year-pill {
  display: inline-flex;
  margin-top: 0;
  color: #92400e !important;
  font-size: .68rem !important;
  line-height: 20px;
}

.program-lines {
  display: grid;
  gap: 8px;
  color: #0f253d;
  font-size: .93rem;
  font-weight: 800;
}

.program-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 900;
}

.program-meta-line span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  background: #f1f6fa;
}

.program-lines span {
  display: block;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 900;
}

.status-box {
  align-self: start;
  justify-self: end;
  width: 190px;
  padding: 12px;
  border-radius: 7px;
  background: #edf8f4;
  color: var(--accent-strong);
}

.status-box.is-possible {
  background: #fff7ed;
  color: var(--warn);
}

.status-box.is-blocked {
  background: #fef2f2;
  color: var(--danger);
}

.status-box strong {
  display: block;
  margin-bottom: 5px;
  font-size: 1rem;
}

.status-box span {
  display: block;
  font-size: .78rem;
  font-weight: 800;
  line-height: 1.4;
}

.requirement-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 10px;
  padding: 0 18px 18px;
}

.requirement-box {
  min-height: 92px;
  padding: 12px;
  border-radius: 7px;
  background: var(--soft);
}

.requirement-box h4 {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: .76rem;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badges.eju-badges {
  display: block;
}

.eju-options {
  display: grid;
  gap: 7px;
  width: 100%;
}

.eju-option {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px;
  border: 1px solid #d9e8f7;
  border-radius: 7px;
  background: #f8fbff;
}

.eju-option:nth-child(6n + 1) {
  border-color: #b9def8;
  background: #f5fbff;
}

.eju-option:nth-child(6n + 2) {
  border-color: #c8ead5;
  background: #f6fdf8;
}

.eju-option:nth-child(6n + 3) {
  border-color: #f3db9f;
  background: #fffaf0;
}

.eju-option:nth-child(6n + 4) {
  border-color: #d9c9f5;
  background: #fbf8ff;
}

.eju-option:nth-child(6n + 5) {
  border-color: #f3c6d6;
  background: #fff7fa;
}

.eju-option:nth-child(6n) {
  border-color: #c5d6f4;
  background: #f7faff;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e6f4ff;
  color: #075985;
  font-size: .78rem;
  font-weight: 900;
}

.badge.is-note {
  background: #edf2f7;
  color: #41566d;
}

.badge.is-option-label {
  min-width: 58px;
  justify-content: center;
  background: #e9f0f7;
  color: #405870;
}

.eju-option:nth-child(6n + 1) .badge.is-option-label {
  background: #dff0ff;
  color: #075985;
}

.eju-option:nth-child(6n + 2) .badge.is-option-label {
  background: #dff5e8;
  color: #166534;
}

.eju-option:nth-child(6n + 3) .badge.is-option-label {
  background: #fff0c2;
  color: #92400e;
}

.eju-option:nth-child(6n + 4) .badge.is-option-label {
  background: #efe7ff;
  color: #5b21b6;
}

.eju-option:nth-child(6n + 5) .badge.is-option-label {
  background: #ffe4ee;
  color: #9f1239;
}

.eju-option:nth-child(6n) .badge.is-option-label {
  background: #e3ecff;
  color: #1d4ed8;
}

.badge.is-sub {
  min-height: 18px;
  padding: 0 7px;
  font-size: .66rem;
}

.source-row {
  padding: 12px 18px;
  border-top: 1px solid #edf2f7;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 800;
}

.source-row a {
  color: var(--accent-strong);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 260px;
  border: 1px dashed #bfd0df;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
}

@media (min-width: 981px) and (max-width: 1500px) {
  .app-header {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 440px);
    column-gap: 32px;
  }

  h1 {
    font-size: clamp(2.1rem, 2.8vw, 2.35rem);
  }
}

@media (max-width: 980px) {
  .app-header {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
    column-gap: 24px;
  }

  .language-switcher {
    flex-wrap: wrap;
    max-width: 320px;
  }
}

@media (max-width: 880px) {
  .update-notice {
    align-items: end;
    padding: 16px;
  }

  .update-notice__dialog {
    max-height: min(82vh, 720px);
    padding: 22px 18px 18px;
  }

  .update-notice__languages {
    gap: 3px;
    margin-right: 42px;
  }

  .update-notice__languages .lang-button {
    flex: 0 0 auto;
    width: 31px;
    max-width: 31px;
    height: 23px;
  }

  .update-notice__university-list {
    grid-template-columns: 1fr;
  }

  .update-notice__actions {
    justify-content: stretch;
  }

  .update-notice__ack {
    width: 100%;
  }

  .app-header {
    grid-template-columns: 1fr;
    grid-template-areas:
      "languages"
      "title"
      "release";
    gap: 12px;
    padding: 16px 14px 18px;
  }

  .language-switcher {
    flex-wrap: nowrap;
    justify-content: flex-start;
    justify-self: stretch;
    max-width: none;
    gap: 2px;
  }

  .lang-button {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    max-width: 36px;
    height: auto;
    aspect-ratio: 7 / 5;
  }

  h1 {
    font-size: 2rem;
    margin-bottom: 0;
    overflow-wrap: anywhere;
  }

  .lead,
  .visitor-counter,
  .usage-meter {
    display: none;
  }

  .release-note {
    justify-self: start;
    width: auto;
    margin-top: -4px;
    color: #7b8a9a;
    font-size: .68rem;
    text-align: left;
  }

  .preview-layout {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px 14px 40px;
  }

  .score-panel {
    position: sticky;
    top: 0;
    z-index: 30;
    padding-bottom: 8px;
    background: #eef3f7;
  }

  .score-panel.is-open {
    position: relative;
    top: auto;
  }

  .score-panel.is-open .mobile-filter-toggle {
    position: sticky;
    top: 0;
    z-index: 31;
  }

  .mobile-filter-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    box-shadow: 0 4px 12px rgba(31, 45, 61, .08);
    font-weight: 900;
  }

  .mobile-filter-toggle::after {
    content: "▾";
    color: var(--accent);
    font-size: 1rem;
  }

  .score-panel.is-open .mobile-filter-toggle::after {
    content: "▴";
  }

  .score-panel > .panel {
    display: none;
    margin-top: 8px;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    box-shadow: 0 10px 22px rgba(31, 45, 61, .12);
  }

  .score-panel.is-open > .panel {
    display: flex;
    flex-direction: column;
    max-height: none;
    overflow: visible;
  }

  #scoreFilterPanel h2 {
    order: 0;
    margin-bottom: 12px;
  }

  #scoreFilterPanel .filter-actions-primary,
  #scoreFilterPanel .filter-actions-bottom {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    margin: 0 0 16px;
  }

  #scoreFilterPanel .filter-actions-primary {
    order: 1;
  }

  #scoreFilterPanel .field-grid {
    order: 2;
  }

  #scoreFilterPanel .english-grid {
    order: 3;
  }

  #scoreFilterPanel .exam-filter {
    order: 4;
  }

  #scoreFilterPanel .metadata-filter {
    order: 5;
  }

  #scoreFilterPanel .filter-actions-bottom {
    order: 6;
    margin: 18px 0 0;
    padding-top: 16px;
    border-top: 1px solid #dbe6ef;
  }

  .results-head,
  .result-card__main,
  .requirement-grid {
    display: block;
  }

  .query-box,
  .status-box {
    width: 100%;
  }

  .query-box {
    display: block;
    margin-top: 14px;
  }

  .status-box {
    margin-top: 14px;
  }

  .requirement-box + .requirement-box {
    margin-top: 10px;
  }
}
