:root {
  --bg: #f4f6fb;
  --card-bg: #ffffff;
  --text: #1f2430;
  --text-muted: #6b7280;
  --primary: #4f7dff;
  --primary-dark: #3b62d6;
  --border: #e5e9f2;
  --radius: 14px;
  --shadow: 0 6px 20px rgba(30, 41, 82, 0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.site-header {
  background: linear-gradient(120deg, #4f7dff 0%, #8b5cf6 100%);
  color: #fff;
  padding: 9px 0 8px;
}

.site-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
}

.site-desc {
  margin-top: 2px;
  font-size: 14px;
  opacity: 0.9;
}

.back-link {
  display: inline-block;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
  opacity: 0.9;
}

.back-link:hover {
  opacity: 1;
}

/* Toolbar */
.toolbar {
  margin: 24px 0 4px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.tool-count {
  color: var(--text-muted);
  font-size: 14px;
}

.search-input {
  flex: 1;
  min-width: 220px;
  max-width: 380px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 125, 255, 0.15);
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  padding: 16px 0 40px;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(30, 41, 82, 0.14);
}

.card-media {
  width: 100%;
  aspect-ratio: 3 / 2;
  background: #eef1f7;
  overflow: hidden;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-body {
  padding: 14px 16px 6px;
}

.card-title {
  font-size: 17px;
  font-weight: 700;
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  min-height: 36px;
}

.card-actions {
  display: flex;
  gap: 10px;
  padding: 10px 16px 16px;
  margin-top: auto;
}

/* Buttons */
.btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Detail */
.detail {
  padding: 32px 0 48px;
}

.detail-hero {
  display: flex;
  gap: 28px;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.detail-media {
  flex: 0 0 340px;
  border-radius: 10px;
  overflow: hidden;
  background: #eef1f7;
}

.detail-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.detail-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-title {
  font-size: 26px;
  font-weight: 700;
}

.detail-subtitle {
  font-size: 15px;
  color: var(--text-muted);
}

.detail-url {
  font-size: 13px;
  color: var(--primary);
  word-break: break-all;
}

.detail-actions {
  display: flex;
  gap: 12px;
  margin-top: auto;
}

.detail-actions .btn {
  flex: 0 0 auto;
  min-width: 120px;
}

/* Manual */
.manual {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px 28px;
  box-shadow: var(--shadow);
}

.manual h2 {
  font-size: 20px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.manual-content h1,
.manual-content h2,
.manual-content h3 {
  margin: 18px 0 10px;
  line-height: 1.4;
}

.manual-content h1 {
  font-size: 22px;
}

.manual-content h2 {
  font-size: 18px;
}

.manual-content h3 {
  font-size: 16px;
}

.manual-content p {
  margin: 8px 0;
}

.manual-content ul,
.manual-content ol {
  margin: 8px 0 8px 22px;
}

.manual-content li {
  margin: 4px 0;
}

.manual-content code {
  background: #eef1f7;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.9em;
  font-family: "SF Mono", Consolas, monospace;
}

.manual-content pre {
  background: #1f2430;
  color: #e5e9f2;
  padding: 14px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 12px 0;
}

.manual-content pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

.manual-content a {
  color: var(--primary);
}

.manual-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

.manual-content blockquote {
  border-left: 3px solid var(--primary);
  padding-left: 12px;
  color: var(--text-muted);
  margin: 10px 0;
}

/* Empty & loading */
.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 60px 0;
}

.hidden {
  display: none;
}

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

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  background: #1f2430;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 999;
}

.toast.show {
  opacity: 1;
  visibility: visible;
}

/* Responsive */
@media (max-width: 1000px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 760px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .detail-hero {
    flex-direction: column;
  }
  .detail-media {
    flex: none;
  }
}

@media (max-width: 480px) {
  .grid {
    grid-template-columns: 1fr;
  }
}