:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #687386;
  --line: #d9e0ea;
  --accent: #1f6feb;
  --accent-soft: #e8f1ff;
  --shadow: 0 18px 60px rgba(23, 32, 51, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Nunito,
    Inter,
    "Noto Sans TC",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 88px;
  padding: 18px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 247, 251, 0.92);
  backdrop-filter: blur(14px);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.15;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.meta span,
.page-actions a,
.frame-heading span,
.frame-heading code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.page-actions a {
  min-height: 40px;
  border-radius: 6px;
  color: #334155;
  font-weight: 800;
  text-decoration: none;
}

.page-actions a:hover,
.page-actions a:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  outline: none;
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  width: min(100%, 1760px);
  margin: 0 auto;
  padding: 24px 32px 56px;
}

.sidebar {
  position: sticky;
  top: 112px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: calc(100vh - 136px);
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 28px rgba(23, 32, 51, 0.06);
}

.sidebar a {
  display: block;
  padding: 9px 10px;
  border-radius: 6px;
  color: #334155;
  font-size: 14px;
  line-height: 1.35;
  text-decoration: none;
}

.sidebar a:hover,
.sidebar a:focus-visible {
  background: var(--accent-soft);
  color: var(--accent);
  outline: none;
}

.frames {
  display: grid;
  gap: 28px;
  min-width: 0;
}

.frame-card {
  scroll-margin-top: 112px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.frame-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.frame-heading h2 {
  overflow: hidden;
  font-size: 18px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.frame-heading span {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.frame-card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  background: #fff;
}

@media (max-width: 980px) {
  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    padding: 18px;
  }

  .layout {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    max-height: none;
  }

  .frame-card {
    scroll-margin-top: 18px;
  }
}

@media (max-width: 640px) {
  .frame-heading {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .frame-heading code {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .frame-heading h2 {
    white-space: normal;
  }
}
