:root {
  --bg: #0f1117;
  --bg-alt: #171a22;
  --card: #1c202b;
  --text: #e6e9f0;
  --muted: #9aa2b1;
  --accent: #6c8cff;
  --border: #2a2f3d;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

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

ul {
  list-style: none;
}

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 17, 23, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.nav-logo {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.5px;
}

.nav-links {
  display: flex;
  gap: 28px;
}

.nav-links a {
  font-size: 0.95rem;
  color: var(--muted);
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--text);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}

.nav-toggle span {
  width: 22px;
  height: 2px;
  background: var(--text);
  transition: transform 0.25s, opacity 0.25s;
}

/* ---------- Hero ---------- */
.hero {
  padding: 120px 0 90px;
  text-align: center;
}

.hero-name {
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  margin-bottom: 14px;
}

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

.hero-sub {
  font-size: 1.25rem;
  color: var(--text);
  margin-bottom: 12px;
}

.hero-desc {
  max-width: 560px;
  margin: 0 auto 32px;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 999px;
  font-size: 0.95rem;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(108, 140, 255, 0.4);
}

.btn-ghost {
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

/* ---------- Sections ---------- */
.section {
  padding: 80px 0;
}

.section-alt {
  background: var(--bg-alt);
}

.section-title {
  font-size: 1.8rem;
  margin-bottom: 20px;
  position: relative;
  padding-bottom: 12px;
}

.section-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 44px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
}

.section-text {
  color: var(--text);
  max-width: 640px;
  margin-bottom: 28px;
}

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

.small {
  font-size: 0.85rem;
}

/* ---------- Cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: transform 0.2s, border-color 0.2s;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

.card h3 {
  margin-bottom: 12px;
  font-size: 1.1rem;
}

.card ul li {
  padding: 4px 0;
  color: var(--muted);
  position: relative;
  padding-left: 18px;
}

.card ul li::before {
  content: "·";
  position: absolute;
  left: 4px;
  color: var(--accent);
  font-weight: 700;
}

.placeholder p {
  color: var(--muted);
  font-size: 0.92rem;
}

/* ---------- Contact ---------- */
.contact-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* ---------- Problem list page ---------- */
.filter-bar {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.filter-search {
  flex: 1;
  min-width: 220px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 20px;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.filter-search::placeholder {
  color: var(--muted);
}

.filter-search:focus {
  border-color: var(--accent);
}

.filter-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-filter {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.btn-filter:hover {
  color: var(--text);
  border-color: var(--muted);
}

.btn-filter.active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(108, 140, 255, 0.08);
}

.problem-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.problem-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  transition: transform 0.2s, border-color 0.2s;
}

.problem-row:hover {
  transform: translateX(4px);
  border-color: var(--accent);
}

.problem-no {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--accent);
  font-weight: 700;
}

.problem-name {
  font-weight: 600;
  font-size: 1.05rem;
}

.problem-tags {
  color: var(--muted);
  font-size: 0.85rem;
  margin-left: auto;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  border: 1px solid var(--border);
  color: var(--muted);
}

.badge.easy {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(74, 222, 128, 0.1);
}

.badge.medium {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.1);
}

.badge.hard {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.1);
}

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

.badge.link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------- Problem detail page ---------- */
.problem-main {
  padding: 48px 0 80px;
}

.problem-main .card {
  margin-bottom: 20px;
}

.problem-main .card h2 {
  font-size: 1.25rem;
  margin-bottom: 12px;
}

.problem-main .section-text {
  margin-bottom: 0;
}

.breadcrumb {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.breadcrumb a:hover {
  color: var(--accent);
}

.problem-header {
  margin-bottom: 28px;
}

.problem-header h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  margin-bottom: 12px;
}

.problem-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.complexity li {
  padding: 4px 0;
  color: var(--text);
}

.complexity b {
  color: var(--accent);
}

.problem-nav {
  margin-top: 32px;
  display: flex;
  gap: 16px;
}

/* ---------- Code blocks & tabs ---------- */
.code-block {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #0b0d12;
}

.code-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.tab {
  background: none;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 6px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(108, 140, 255, 0.08);
}

.code {
  display: none;
  padding: 20px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #c9d1d9;
}

.code.active {
  display: block;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: rgba(108, 140, 255, 0.12);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer a:hover {
  color: var(--accent);
}

/* ---------- Reveal animation ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .hero {
    padding: 80px 0 60px;
  }

  .nav-links {
    position: fixed;
    top: 60px;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    width: 100%;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  .nav-links.open {
    max-height: 280px;
  }

  .nav-links a {
    display: block;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
  }

  .nav-toggle {
    display: flex;
  }

  .nav-toggle.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .nav-toggle.active span:nth-child(2) {
    opacity: 0;
  }

  .nav-toggle.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
}
