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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #fafaf8;
  color: #1a1a1a;
  line-height: 1.6;
  max-width: 52rem;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

header {
  margin-bottom: 2rem;
}

h1 {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.subtitle {
  color: #666;
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.search-bar {
  display: flex;
  gap: 0.5rem;
}

#query {
  flex: 1;
  padding: 0.6rem 0.8rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
}

#query:focus {
  outline: none;
  border-color: #555;
}

button[type="submit"] {
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

button[type="submit"]:hover {
  background: #333;
}

.settings {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: #555;
}

.settings summary {
  cursor: pointer;
  user-select: none;
}

.settings label {
  display: inline-block;
  margin-top: 0.5rem;
  margin-right: 1.5rem;
}

.settings input[type="number"] {
  width: 5rem;
  padding: 0.25rem 0.4rem;
  font-size: 0.85rem;
  border: 1px solid #ccc;
  border-radius: 3px;
  margin-left: 0.25rem;
}

.status {
  margin-top: 1.25rem;
  font-size: 0.9rem;
  color: #555;
}

.status.error {
  color: #b91c1c;
}

#results {
  margin-top: 1rem;
}

.result {
  border-top: 1px solid #e5e5e5;
  padding: 1rem 0;
}

.result-header {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.result-header .page-num {
  color: #1a1a1a;
}

.result-header .meta {
  font-weight: 400;
  font-size: 0.8rem;
  color: #888;
}

.snippet-pair {
  margin-bottom: 0.75rem;
}

.snippet {
  font-size: 0.9rem;
  line-height: 1.5;
  padding: 0.3rem 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.snippet .lang-tag {
  display: inline-block;
  width: 2rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: #999;
  text-transform: uppercase;
  flex-shrink: 0;
}

.snippet mark {
  background: #fde68a;
  color: inherit;
  padding: 0.05em 0.1em;
  border-radius: 2px;
}

.summary {
  font-size: 0.85rem;
  color: #666;
  padding-top: 0.5rem;
  border-top: 1px solid #e5e5e5;
}

.page-view {
  margin-top: 1rem;
  border-top: 1px solid #e5e5e5;
  padding: 1rem 0;
}

.page-view h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.page-text {
  font-size: 0.9rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 0.5rem 0;
}

.page-nav {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  font-size: 0.9rem;
}

.page-nav a {
  color: #1a1a1a;
  text-decoration: none;
}

.page-nav a:hover {
  text-decoration: underline;
}

.loading {
  opacity: 0.5;
  pointer-events: none;
}
