:root {
  --bg: #0b1020;
  --bg2: #0a162d;
  --panel: rgba(255, 255, 255, 0.06);
  --panel2: rgba(255, 255, 255, 0.085);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.68);
  --border: rgba(255, 255, 255, 0.12);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.32);
  --accent: #77a7ff;
  --accent2: #7cffc6;
  --danger: #ff5c7a;
  --radius: 18px;
  --container: 1120px;
  --topbar-h: 68px;
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans",
    sans-serif;
}

html[data-theme="light"] {
  --bg: #f7f9ff;
  --bg2: #eef4ff;
  --panel: rgba(255, 255, 255, 0.7);
  --panel2: rgba(255, 255, 255, 0.9);
  --text: rgba(16, 22, 40, 0.92);
  --muted: rgba(16, 22, 40, 0.62);
  --border: rgba(16, 22, 40, 0.12);
  --shadow: 0 14px 36px rgba(10, 20, 40, 0.14);
  --accent: #2f67ff;
  --accent2: #00a870;
  --danger: #d0223f;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: radial-gradient(1200px 800px at 12% 4%, rgba(119, 167, 255, 0.22), transparent 55%),
    radial-gradient(900px 700px at 84% 10%, rgba(124, 255, 198, 0.16), transparent 60%),
    radial-gradient(900px 700px at 70% 92%, rgba(255, 92, 122, 0.12), transparent 55%),
    linear-gradient(160deg, var(--bg), var(--bg2));
  min-height: 100vh;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95em;
  background: rgba(127, 161, 255, 0.12);
  border: 1px solid rgba(127, 161, 255, 0.18);
  padding: 0.12em 0.34em;
  border-radius: 10px;
}

.container {
  width: min(var(--container), calc(100% - 40px));
  margin: 0 auto;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: 10px;
  padding: 10px 12px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 12px;
  transform: translateY(-200%);
  transition: transform 140ms ease;
  z-index: 9999;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: var(--panel2);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-bottom: 1px solid var(--border);
}

.topbar__inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 230px;
}

.brand__mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(119, 167, 255, 0.32), rgba(124, 255, 198, 0.18));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow);
}

html[data-theme="light"] .brand__mark {
  border-color: rgba(10, 20, 40, 0.12);
}

.brand__text {
  display: grid;
  line-height: 1.05;
}

.brand__title {
  font-weight: 780;
  letter-spacing: -0.02em;
}

.brand__subtitle {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav__link {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  color: var(--muted);
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.nav__link:hover {
  background: var(--panel);
  border-color: var(--border);
  color: var(--text);
}

.nav__link[aria-current="page"] {
  color: var(--text);
  background: var(--panel2);
  border-color: var(--border);
}

.nav__link--accent {
  color: var(--text);
  background: linear-gradient(135deg, rgba(119, 167, 255, 0.28), rgba(124, 255, 198, 0.16));
  border-color: rgba(127, 161, 255, 0.24);
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  transition: transform 140ms ease, background 140ms ease;
}

.pill:hover {
  transform: translateY(-1px);
  background: var(--panel2);
}

.pill__icon {
  color: var(--accent2);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease;
}

.icon-btn:hover {
  transform: translateY(-1px);
  background: var(--panel2);
}

.icon-btn:active {
  transform: translateY(0);
}

.icon-btn__label {
  font-size: 13px;
  color: var(--muted);
}

.hero {
  position: relative;
  padding: 54px 0 28px;
  overflow: clip;
}

.hero__bg {
  position: absolute;
  inset: -30px;
  background-image: url("images/Rewriting.png");
  background-size: cover;
  background-position: center;
  filter: blur(36px) saturate(1.2);
  opacity: 0.22;
  transform: scale(1.12);
  pointer-events: none;
}

.hero__inner {
  position: relative;
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 22px;
  align-items: start;
}

.hero__copy {
  padding: 18px 0;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 12px;
}

.hero__title {
  font-size: clamp(28px, 3.2vw, 46px);
  line-height: 1.05;
  margin: 0 0 14px;
  letter-spacing: -0.03em;
}

.hero__lead {
  font-size: clamp(15px, 1.55vw, 18px);
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 18px;
  max-width: 58ch;
}

.hero__lead .em {
  color: var(--text);
  font-weight: 650;
}

.hero__cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 18px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  transition: transform 140ms ease, background 140ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  background: var(--panel2);
}

.btn--primary {
  background: linear-gradient(135deg, rgba(119, 167, 255, 0.35), rgba(124, 255, 198, 0.2));
  border-color: rgba(127, 161, 255, 0.28);
}

.btn--ghost {
  background: transparent;
}

.hero__meta {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.meta {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.meta__label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.meta__value {
  font-size: 14px;
  line-height: 1.45;
}

.section {
  padding: 56px 0;
}

.section--soft {
  background: var(--bg);
  background: radial-gradient(900px 520px at 10% 10%, rgba(119, 167, 255, 0.12), transparent 55%),
    radial-gradient(700px 460px at 86% 24%, rgba(124, 255, 198, 0.1), transparent 55%),
    color-mix(in srgb, var(--bg) 90%, transparent);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section__head {
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
}

.section__head h2 {
  margin: 0;
  font-size: clamp(22px, 2.1vw, 32px);
  letter-spacing: -0.02em;
}

.section__head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  max-width: 76ch;
}

.muted {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 14px;
}

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

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

.card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 18px 18px;
}

.card h3 {
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.card p + p {
  margin-top: 10px;
}

.card--media {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
  padding: 12px;
}

.card__body {
  padding: 6px 10px 0;
}

.list {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.6;
}

.list li + li {
  margin-top: 8px;
}

.prose {
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.prose p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.prose p + p {
  margin-top: 12px;
}

.figure-card {
  overflow: hidden;
  cursor: zoom-in;
}

.figure-card img {
  width: 100%;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.06);
}

.figure-card figcaption {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 14px;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

.table-wrap {
  margin-top: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  overflow: auto;
  background: var(--panel2);
  background: color-mix(in srgb, var(--panel2) 50%, transparent);
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

.table th,
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 14px;
  color: var(--muted);
}

.table thead th {
  color: var(--text);
  font-weight: 650;
}

.table tbody tr:last-child th,
.table tbody tr:last-child td {
  border-bottom: none;
}

.rank {
  color: var(--text);
  font-weight: 650;
}

.rank--1 {
  background: color-mix(in srgb, var(--accent2) 22%, transparent);
  color: var(--text);
}

.rank--2 {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--text);
}

.footer {
  padding: 22px 0 36px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
}

.footer__inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.footer__brand {
  font-weight: 780;
  letter-spacing: -0.02em;
}

.footer__note {
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.55;
  max-width: 54ch;
}

.footer__right {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.footer__link:hover {
  color: var(--text);
  text-decoration: underline;
}

.footer__sep {
  opacity: 0.6;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  padding: 18px;
}

.lightbox[hidden] {
  display: none;
}

.lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
}

.lightbox__panel {
  position: relative;
  width: min(1080px, 100%);
  border-radius: 20px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 60%, transparent);
  border: 1px solid var(--border);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  padding: 14px;
  display: grid;
  gap: 10px;
}

.lightbox__close {
  position: absolute;
  right: 10px;
  top: 10px;
}

.lightbox__img {
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.12);
}

.lightbox__caption {
  color: var(--muted);
  line-height: 1.6;
  padding: 0 6px 4px;
}

@media (max-width: 980px) {
  .hero__inner {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 820px) {
  .nav__links {
    gap: 6px;
    overflow-x: auto;
    max-width: min(62vw, 520px);
    padding: 2px 0;
    scrollbar-width: none;
  }

  .nav__links::-webkit-scrollbar {
    display: none;
  }

  .nav__link {
    white-space: nowrap;
  }

  .icon-btn__label {
    display: none;
  }

  .icon-btn__label[data-lang-label] {
    display: inline;
  }

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