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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: #24292f;
  background: #f6f8fa;
  line-height: 1.5;
}

a {
  color: #0969da;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* Layout */
.header {
  background: #24292f;
  color: #fff;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.header a {
  color: #fff;
  font-weight: 600;
  font-size: 18px;
}
.header .search {
  flex: 1;
  max-width: 400px;
}
.header input {
  width: 100%;
  padding: 5px 12px;
  border: 1px solid #57606a;
  border-radius: 6px;
  background: #161b22;
  color: #f0f6fc;
  font-size: 14px;
  outline: none;
}
.header input:focus {
  border-color: #58a6ff;
  box-shadow: 0 0 0 3px rgba(56, 139, 253, 0.4);
}

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

/* Search results / repo list */
.repo-list {
  list-style: none;
}
.repo-item {
  padding: 24px 0;
  border-bottom: 1px solid #d0d7de;
}
.repo-item h3 {
  font-size: 20px;
  margin-bottom: 4px;
}
.repo-item h3 a {
  color: #0969da;
}
.repo-item p {
  color: #57606a;
  font-size: 14px;
  margin-bottom: 8px;
}
.repo-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: #57606a;
}
.repo-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}
.lang-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

/* Repo detail */
.repo-header {
  background: #fff;
  border-bottom: 1px solid #d0d7de;
  padding: 16px 0;
}
.repo-header h1 {
  font-size: 20px;
  font-weight: 400;
}
.repo-header h1 a {
  font-weight: 600;
}
.repo-header .stats {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  font-size: 13px;
  color: #57606a;
}

.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #d0d7de;
  background: #fff;
}
.tab-nav a {
  padding: 8px 16px;
  font-size: 14px;
  color: #57606a;
  border-bottom: 2px solid transparent;
}
.tab-nav a.active {
  color: #24292f;
  font-weight: 600;
  border-bottom-color: #fd8c73;
}

/* File tree */
.file-tree {
  background: #fff;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  overflow: hidden;
}
.file-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid #d0d7de;
  font-size: 14px;
}
.file-row:last-child {
  border-bottom: none;
}
.file-row .icon {
  width: 16px;
  text-align: center;
  color: #57606a;
}
.file-row a {
  flex: 1;
}

/* Readme / content */
.readme {
  background: #fff;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  padding: 32px;
  margin-top: 16px;
}
.readme h1,
.readme h2,
.readme h3 {
  margin: 16px 0 8px;
}
.readme p {
  margin-bottom: 12px;
}
.readme code {
  background: #f6f8fa;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 85%;
}
.readme pre {
  background: #f6f8fa;
  padding: 16px;
  border-radius: 6px;
  overflow-x: auto;
  margin-bottom: 16px;
}

/* Issues */
.issue-row {
  padding: 12px 0;
  border-bottom: 1px solid #d0d7de;
}
.issue-row h3 {
  font-size: 16px;
}
.issue-meta {
  font-size: 12px;
  color: #57606a;
  margin-top: 4px;
}
.label {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  margin-left: 4px;
}

/* States */
.loading {
  padding: 40px;
  text-align: center;
  color: #57606a;
}
.error {
  padding: 16px;
  background: #ffebe9;
  border: 1px solid #ff818266;
  border-radius: 6px;
  color: #82071e;
  margin-bottom: 16px;
}
.rate-limit {
  padding: 24px;
  text-align: center;
  color: #57606a;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
}
.pagination button {
  padding: 6px 16px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
}
.pagination button:disabled {
  opacity: 0.5;
  cursor: default;
}
.pagination button:hover:not(:disabled) {
  background: #f3f4f6;
}

/* Breadcrumb */
.breadcrumb {
  padding: 8px 0;
  margin-bottom: 8px;
  font-size: 14px;
}
.breadcrumb a {
  color: #0969da;
}
.breadcrumb span {
  color: #57606a;
}

/* File view (foreign code viewer) */
.file-view {
  background: #fff;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  overflow: hidden;
  margin-top: 16px;
}
.code-viewer {
  width: 100%;
}
.code-header {
  padding: 8px 16px;
  background: #f6f8fa;
  border-bottom: 1px solid #d0d7de;
  font-size: 13px;
  color: #57606a;
  font-weight: 500;
}
.code-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.45;
  tab-size: 4;
}
.code-table td {
  vertical-align: top;
}
.line-num {
  width: 1%;
  min-width: 50px;
  padding: 0 10px 0 16px;
  text-align: right;
  color: #8b949e;
  user-select: none;
  white-space: nowrap;
  cursor: pointer;
  border-right: 1px solid #d0d7de;
}
.line-num:hover {
  color: #0969da;
}
.line-content {
  padding: 0 16px;
  white-space: pre;
  overflow-x: auto;
}
.line-content code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  background: none;
  padding: 0;
}
