:root {
  color-scheme: light dark;
  font-family: "Segoe UI", Meiryo, sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: start center;
  padding: 2rem 1rem;
  background: linear-gradient(135deg, #0f172a, #2563eb);
  color: #f8fafc;
}

.card {
  width: min(96vw, 980px);
  padding: 2rem;
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.8);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
  text-align: left;
}

.eyebrow {
  margin: 0 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.8rem;
  color: #93c5fd;
}

h1 {
  margin: 0 0 0.75rem;
  font-size: 2rem;
}

.lead {
  margin: 0.2rem 0 1rem;
}

p {
  line-height: 1.7;
  color: #e2e8f0;
}

.rank-summary {
  margin: 0 0 1rem;
  padding: 1rem;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(147, 197, 253, 0.25);
}

.rank-link {
  display: block;
  padding: 1rem;
  border-radius: 14px;
  text-decoration: none;
  color: #e2e8f0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.rank-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

.rank-link + .rank-link {
  margin-top: 0.8rem;
}

.rank-link-s {
  background: rgba(250, 204, 21, 0.24);
}

.rank-link-a {
  background: rgba(37, 99, 235, 0.28);
}

.rank-link-b {
  background: rgba(14, 165, 233, 0.24);
}

.rank-link-c {
  background: rgba(34, 197, 94, 0.24);
}

.rank-link-d {
  background: rgba(249, 115, 22, 0.24);
}

.rank-link-e {
  background: rgba(239, 68, 68, 0.24);
}

.rank-link-rank {
  background: rgba(148, 163, 184, 0.24);
}

.rank-link-science {
  background: rgba(45, 212, 191, 0.24);
}

.rank-link__label {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
}

.rank-link__text {
  display: block;
  margin-top: 0.35rem;
  color: #dbeafe;
}

.rank-summary h2 {
  margin: 0;
  font-size: 1.1rem;
  color: #bae6fd;
}

.rank-summary p {
  margin: 0.35rem 0 0.8rem;
}

.rank-summary p:last-child {
  margin-bottom: 0;
}

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  color: #bfdbfe;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.rank-table {
  margin: 1rem 0 0;
  padding: 1rem;
  border-radius: 12px;
  background: rgba(30, 41, 59, 0.75);
  color: #e2e8f0;
  font-family: "Meiryo UI", Meiryo, sans-serif;
  font-size: 0.98rem;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.rank-detail {
  margin-top: 1.5rem;
  padding: 1.4rem 1.35rem;
  border-radius: 14px;
  border: 1px solid var(--page-card-border, rgba(255, 255, 255, 0.16));
  background: var(--page-summary-bg, rgba(255, 255, 255, 0.06));
}

.rank-detail h2 {
  margin: 1.4rem 0 0.6rem;
  font-size: 1.15rem;
  color: var(--page-accent, #93c5fd);
}

.rank-detail h2:first-child {
  margin-top: 0;
}

.rank-detail p,
.rank-detail li {
  color: var(--page-text, #e2e8f0);
  line-height: 1.75;
}

.rank-detail ul {
  margin: 0.4rem 0 0.8rem;
  padding-left: 1.4rem;
}

.rank-detail-table {
  width: 100%;
  margin-top: 0.6rem;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.rank-detail-table th,
.rank-detail-table td {
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--page-card-border, rgba(255, 255, 255, 0.16));
  text-align: left;
  vertical-align: top;
  color: var(--page-text, #e2e8f0);
}

.rank-detail-table th {
  background: rgba(255, 255, 255, 0.08);
  font-weight: 700;
}

.rank-detail-table tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.03);
}

.rank-detail-note {
  margin-top: 0.9rem;
  font-size: 0.85rem;
  color: var(--page-muted, #94a3b8);
}

body.rank-page {
  --page-bg-start: #111827;
  --page-bg-end: #020617;
  --page-accent: #f8fafc;
  --page-accent-soft: rgba(248, 250, 252, 0.14);
  --page-card-bg: rgba(9, 14, 28, 0.72);
  --page-card-border: rgba(255, 255, 255, 0.16);
  --page-summary-bg: rgba(255, 255, 255, 0.08);
  --page-summary-border: rgba(255, 255, 255, 0.12);
  --page-text: #e5eefb;
  --page-muted: #bfd3ee;
  --page-heading-font: "Yu Mincho", "Hiragino Mincho ProN", Georgia, serif;
  padding: 3rem 1.25rem;
  place-items: center;
  background:
    radial-gradient(circle at top left, var(--page-accent-soft), transparent 32%),
    radial-gradient(circle at bottom right, rgba(255, 255, 255, 0.1), transparent 24%),
    linear-gradient(135deg, var(--page-bg-start), var(--page-bg-end));
  color: var(--page-text);
}

body.rank-page .card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: min(92vw, 820px);
  padding: 2.5rem;
  border: 1px solid var(--page-card-border);
  background: var(--page-card-bg);
  box-shadow: 0 30px 80px rgba(2, 6, 23, 0.42);
}

body.rank-page .card::before,
body.rank-page .card::after {
  content: "";
  position: absolute;
  inset: auto;
  pointer-events: none;
  z-index: -1;
}

body.rank-page .card::before {
  top: -4.5rem;
  right: -3rem;
  width: 14rem;
  height: 14rem;
  border-radius: 50%;
  background: radial-gradient(circle, var(--page-accent-soft), transparent 68%);
}

body.rank-page .card::after {
  left: -2rem;
  bottom: -2.5rem;
  width: 11rem;
  height: 11rem;
  border-radius: 2rem;
  transform: rotate(18deg);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.14), transparent 70%);
}

body.rank-page .back-link {
  margin-bottom: 1.5rem;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--page-card-border);
  border-radius: 999px;
  color: var(--page-muted);
  background: rgba(255, 255, 255, 0.05);
}

body.rank-page .back-link:hover {
  text-decoration: none;
  color: var(--page-text);
  background: rgba(255, 255, 255, 0.1);
}

body.rank-page .eyebrow {
  margin-bottom: 0.75rem;
  color: var(--page-accent);
  letter-spacing: 0.28em;
}

body.rank-page h1 {
  font-family: var(--page-heading-font);
  font-size: clamp(2.1rem, 5vw, 3.7rem);
  line-height: 1.08;
  margin-bottom: 1rem;
}

body.rank-page .lead {
  max-width: 38rem;
  font-size: 1.05rem;
  color: var(--page-muted);
  margin-bottom: 1.6rem;
}

body.rank-page p {
  color: var(--page-text);
}

body.rank-page .rank-summary {
  padding: 1.4rem 1.35rem;
  border: 1px solid var(--page-summary-border);
  background: var(--page-summary-bg);
  backdrop-filter: blur(10px);
}

body.rank-page .rank-summary h2 {
  margin-bottom: 0.2rem;
  color: var(--page-accent);
  font-size: 1rem;
  letter-spacing: 0.08em;
}

body.rank-page .rank-summary p {
  color: var(--page-text);
}

body.rank-page:not(.rank-page-a) .rank-summary {
  position: relative;
  padding-top: 3.2rem;
}

body.rank-page:not(.rank-page-a) .rank-summary::before {
  content: "掲載大学リスト";
  position: absolute;
  top: 1rem;
  left: 1.2rem;
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--page-card-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--page-accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

body.rank-page:not(.rank-page-a) .rank-summary p {
  margin: 0;
  font-size: 1.04rem;
  line-height: 2.05;
  letter-spacing: 0.04em;
}

body.rank-page-a {
  --page-bg-start: #1f2937;
  --page-bg-end: #0f172a;
  --page-accent: #f8d57e;
  --page-accent-soft: rgba(248, 213, 126, 0.24);
  --page-card-bg: linear-gradient(160deg, rgba(31, 41, 55, 0.9), rgba(15, 23, 42, 0.76));
  --page-card-border: rgba(248, 213, 126, 0.28);
  --page-summary-bg: linear-gradient(145deg, rgba(87, 64, 18, 0.3), rgba(255, 255, 255, 0.04));
  --page-summary-border: rgba(248, 213, 126, 0.22);
  --page-text: #fff8e6;
  --page-muted: #f5dfaa;
}

body.rank-page-a .card {
  border-radius: 2rem 5.5rem 2rem 2rem;
}

body.rank-page-b {
  --page-bg-start: #02131f;
  --page-bg-end: #0f3b57;
  --page-accent: #67e8f9;
  --page-accent-soft: rgba(103, 232, 249, 0.28);
  --page-card-bg: rgba(4, 24, 38, 0.64);
  --page-card-border: rgba(103, 232, 249, 0.28);
  --page-summary-bg: linear-gradient(135deg, rgba(8, 51, 74, 0.72), rgba(6, 182, 212, 0.12));
  --page-summary-border: rgba(125, 211, 252, 0.18);
  --page-text: #e0fbff;
  --page-muted: #b7f6ff;
  --page-heading-font: "Yu Gothic", "Hiragino Kaku Gothic ProN", sans-serif;
}

body.rank-page-b .card {
  border-radius: 1.6rem;
  box-shadow: 0 0 0 1px rgba(103, 232, 249, 0.08), 0 32px 90px rgba(0, 0, 0, 0.4);
}

body.rank-page-b .rank-summary p {
  text-shadow: 0 0 18px rgba(103, 232, 249, 0.12);
}

body.rank-page-b .card::after {
  left: auto;
  right: 2rem;
  bottom: 1.2rem;
  width: 12rem;
  height: 0.18rem;
  border-radius: 999px;
  transform: none;
  background: linear-gradient(90deg, transparent, rgba(103, 232, 249, 0.9), transparent);
}

body.rank-page-c {
  --page-bg-start: #0f2d1f;
  --page-bg-end: #092316;
  --page-accent: #86efac;
  --page-accent-soft: rgba(134, 239, 172, 0.24);
  --page-card-bg: linear-gradient(180deg, rgba(8, 26, 18, 0.88), rgba(15, 45, 31, 0.72));
  --page-card-border: rgba(134, 239, 172, 0.22);
  --page-summary-bg: rgba(13, 44, 29, 0.72);
  --page-summary-border: rgba(163, 230, 53, 0.18);
  --page-text: #ecfdf3;
  --page-muted: #c8f7d6;
}

body.rank-page-c .card {
  border-radius: 3.5rem 1.4rem 3.5rem 1.4rem;
}

body.rank-page-c .rank-summary {
  box-shadow: inset 0 0 0 1px rgba(134, 239, 172, 0.08);
}

body.rank-page-c .rank-summary p {
  column-count: 2;
  column-gap: 2rem;
}

body.rank-page-d {
  --page-bg-start: #3b1d12;
  --page-bg-end: #140c09;
  --page-accent: #fb923c;
  --page-accent-soft: rgba(251, 146, 60, 0.24);
  --page-card-bg: linear-gradient(135deg, rgba(39, 19, 10, 0.92), rgba(20, 12, 9, 0.8));
  --page-card-border: rgba(251, 146, 60, 0.24);
  --page-summary-bg: rgba(67, 31, 14, 0.74);
  --page-summary-border: rgba(253, 186, 116, 0.18);
  --page-text: #fff1e8;
  --page-muted: #ffd1b0;
}

body.rank-page-d .card {
  border-radius: 0 3rem 0 3rem;
}

body.rank-page-d .card::before {
  top: auto;
  bottom: -5rem;
  right: -1rem;
  width: 16rem;
  height: 16rem;
}

body.rank-page-d .rank-summary {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 28%),
    rgba(67, 31, 14, 0.74);
}

body.rank-page-e {
  --page-bg-start: #3b0d24;
  --page-bg-end: #140811;
  --page-accent: #f9a8d4;
  --page-accent-soft: rgba(249, 168, 212, 0.28);
  --page-card-bg: linear-gradient(160deg, rgba(47, 12, 31, 0.88), rgba(20, 8, 17, 0.78));
  --page-card-border: rgba(249, 168, 212, 0.24);
  --page-summary-bg: linear-gradient(145deg, rgba(67, 18, 46, 0.74), rgba(255, 255, 255, 0.05));
  --page-summary-border: rgba(244, 114, 182, 0.2);
  --page-text: #fff1f7;
  --page-muted: #ffd3e7;
}

body.rank-page-e .card {
  border-radius: 2.5rem;
}

body.rank-page-e .rank-summary {
  border-style: dashed;
}

body.rank-page-e .rank-summary p {
  font-style: italic;
}

@media (max-width: 640px) {
  body.rank-page {
    padding: 1.25rem 0.9rem;
  }

  body.rank-page .card {
    width: min(100vw, 820px);
    padding: 1.5rem;
  }

  body.rank-page h1 {
    font-size: 2rem;
  }

  body.rank-page .card::before {
    width: 10rem;
    height: 10rem;
  }

  body.rank-page .card::after {
    width: 8rem;
    height: 8rem;
  }

  body.rank-page:not(.rank-page-a) .rank-summary {
    padding-top: 3rem;
  }

  body.rank-page-c .rank-summary p {
    column-count: 1;
  }
}
