* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-hover: #f1f5f9;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text: #0f172a;
  --text-dim: #475569;
  --text-faint: #94a3b8;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --blue: #2563eb;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: 'Consolas', 'Courier New', monospace;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

a { color: var(--blue); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }

.banner {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
}

.searchbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.searchbar input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  flex: 1;
  min-width: 0;
}

.searchbar input::placeholder { color: var(--text-faint); }

#qCount {
  color: var(--text-faint);
  font-size: 12px;
  white-space: nowrap;
}

.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar button,
button {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.toolbar button:hover,
button:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--bg-hover);
}

.meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 8px 0;
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}

.meta b { color: var(--text); font-weight: 600; }

h2 {
  font-size: 16px;
  color: var(--text);
  font-weight: 600;
  padding: 8px 0;
  margin: 20px 0 12px 0;
  border-bottom: 2px solid var(--border);
}

p.meta {
  color: var(--text-dim);
  font-size: 13px;
  margin: 4px 0 12px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  margin-bottom: 16px;
  table-layout: fixed;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

table td, table th {
  border-bottom: 1px solid var(--border-light);
  padding: 8px 12px;
  vertical-align: top;
  text-align: left;
  word-break: break-word;
  overflow-wrap: break-word;
}

table tr:last-child td {
  border-bottom: none;
}

table tr:hover td { background: var(--bg-hover); }

table td:first-child {
  color: var(--text-dim);
  font-weight: 500;
  white-space: nowrap;
  width: 140px;
  background: #f8fafc;
}

pre.code, pre.roast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 12px 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

pre.roast {
  background: #fffbe3;
  border-color: #fef08a;
  color: #713f12;
}

.footer {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 24px;
  z-index: 900;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  color: #ffffff;
  font-size: 13px;
  padding: 10px 20px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  display: none;
}

.toast.on { display: block; }

.red { color: var(--red); font-weight: 600; }
.grn { color: var(--green); font-weight: 600; }
.amb { color: var(--amber); font-weight: 600; }

#raw { margin-top: 20px; }

@media (max-width: 768px) {
  body { padding: 16px; font-size: 13px; }
  table td:first-child { white-space: normal; width: auto; background: transparent; }
  .meta { gap: 10px; }
}

@media (max-width: 500px) {
  table { font-size: 12px; }
  table td, table th { padding: 6px 8px; }
}