:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #667085;
  --line: #d9e2ec;
  --paper: #ffffff;
  --field: #f5f7fa;
  --sidebar: #19192b;
  --sidebar-muted: #a9adbb;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --red: #b91c1c;
  --shadow: 0 18px 55px rgba(23, 32, 42, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--field);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  min-height: 100vh;
  padding: 30px 18px;
  background: var(--sidebar);
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px 28px;
  color: #fff;
  text-decoration: none;
}

.brand img {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 10px;
}

.brand span {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.brand strong {
  font-size: 18px;
  font-weight: 850;
}

.brand small {
  color: var(--sidebar-muted);
  font-size: 12px;
}

.portal-nav {
  display: grid;
  gap: 8px;
}

.portal-link {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #c8cad4;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  text-decoration: none;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.portal-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  transform: translateX(2px);
}

.portal-link.active {
  border-color: rgba(255, 255, 255, 0.14);
  background: #fff;
  color: var(--sidebar);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
}

.portal-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: var(--sidebar-muted);
  font-size: 11px;
  font-weight: 850;
}

.portal-link.active .portal-number {
  border-color: #fecaca;
  background: #fef2f2;
  color: var(--red);
}

.content {
  width: min(1180px, calc(100% - 64px));
  margin: 0 auto;
}

.hero {
  padding: 56px 0 30px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 62px);
  line-height: 1.05;
  letter-spacing: 0;
}

.hero > p:last-child {
  max-width: 760px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 20px);
}

.gallery {
  display: grid;
  gap: 28px;
  padding: 8px 0 64px;
}

.figure-card {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.figure-card img {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
}

.figure-card figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 15px;
}

.figure-card b {
  color: var(--ink);
  font-weight: 800;
}

.open-original {
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.empty-state {
  display: flex;
  align-items: center;
  gap: 30px;
  min-height: 260px;
  margin: 8px 0 64px;
  padding: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.empty-number {
  color: var(--red);
  font-size: clamp(54px, 8vw, 98px);
  font-weight: 900;
  line-height: 1;
}

.empty-state h2 {
  margin: 0 0 8px;
  font-size: 24px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    z-index: 20;
    min-height: 0;
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  }

  .brand {
    padding: 0 4px 10px;
  }

  .brand img {
    width: 34px;
    height: 34px;
    border-radius: 8px;
  }

  .brand strong {
    font-size: 16px;
  }

  .brand small {
    display: none;
  }

  .portal-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .portal-link {
    grid-template-columns: 24px minmax(0, 1fr);
    min-height: 48px;
    padding: 7px 8px;
    font-size: 12px;
  }

  .portal-link:hover {
    transform: none;
  }

  .portal-number {
    width: 24px;
    height: 24px;
    font-size: 10px;
  }

  .content {
    width: min(100% - 24px, 1180px);
  }

  .hero {
    padding: 36px 0 22px;
  }

  .gallery {
    gap: 18px;
    padding-bottom: 40px;
  }

  .figure-card figcaption {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
    padding: 12px 14px;
  }

  .empty-state {
    align-items: flex-start;
    flex-direction: column;
    gap: 20px;
    min-height: 0;
    padding: 28px 24px;
  }
}

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

  .portal-link {
    transition: none;
  }
}
