.tool-tabs {
  display: flex;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: #f8fafb;
}

.tool-tab {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.tool-tab.active {
  border-color: var(--line);
  background: white;
  color: var(--brand);
  box-shadow: 0 4px 14px rgba(16, 43, 66, .06);
}

.pdf-panel { padding: 28px; }
.pdf-panel[hidden] { display: none; }
.file-list { display: grid; gap: 8px; margin: 16px 0; }
.file-pill {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fafcfd;
}
.file-pill span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 10px;
  font-weight: 850;
}
.file-pill strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.file-pill small { color: var(--muted); font-size: 10px; }

.qr-output {
  min-height: 330px;
  display: grid;
  place-items: center;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8fafb;
}
.qr-output canvas, .qr-output img { max-width: 100%; height: auto; border: 12px solid white; box-shadow: 0 12px 30px rgba(16, 43, 66, .1); }
.paste-hint {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.paste-hint kbd {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: white;
  color: var(--ink);
  font: inherit;
}

.markdown-layout { min-height: 610px; }
.markdown-layout .utility-pane { display: flex; flex-direction: column; }
.markdown-layout .code-area { min-height: 500px; flex: 1; }
.markdown-preview {
  min-height: 500px;
  overflow-wrap: anywhere;
  color: #233240;
  font-size: 14px;
  line-height: 1.75;
}
.markdown-preview > :first-child { margin-top: 0; }
.markdown-preview h1, .markdown-preview h2, .markdown-preview h3 { color: var(--ink); line-height: 1.25; }
.markdown-preview h1, .markdown-preview h2 { padding-bottom: .35em; border-bottom: 1px solid var(--line); }
.markdown-preview pre { overflow: auto; padding: 15px; border-radius: 12px; background: #152433; color: #edf6fc; }
.markdown-preview code { padding: .16em .35em; border-radius: 5px; background: #edf3f7; font-family: "SFMono-Regular", Consolas, monospace; }
.markdown-preview pre code { padding: 0; background: transparent; }
.markdown-preview blockquote { margin-left: 0; padding-left: 16px; border-left: 4px solid var(--brand); color: var(--muted); }
.markdown-preview table { width: 100%; border-collapse: collapse; }
.markdown-preview th, .markdown-preview td { padding: 8px 10px; border: 1px solid var(--line); text-align: left; }
.markdown-preview img { max-width: 100%; }

.result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.large-result {
  min-height: 116px;
  display: grid;
  place-items: center;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafb;
  color: var(--brand-dark);
  text-align: center;
}
.large-result strong { display: block; font-size: clamp(22px, 4vw, 34px); }
.large-result span { display: block; margin-top: 8px; color: var(--muted); font-size: 11px; }

.kinship-path {
  min-height: 62px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f8fafb;
  color: var(--muted);
  font-size: 13px;
}
.kinship-path span {
  padding: 6px 9px;
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-weight: 750;
  box-shadow: 0 2px 8px rgba(16, 43, 66, .06);
}
.kinship-keys { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 16px 0; }
.kinship-key {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: white;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}
.kinship-key:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.kinship-answer {
  min-height: 260px;
  display: grid;
  place-items: center;
  padding: 30px;
  border-radius: 18px;
  background: linear-gradient(145deg, var(--brand), var(--brand-dark));
  color: white;
  text-align: center;
}
.kinship-answer strong { display: block; font-size: clamp(28px, 5vw, 46px); letter-spacing: -.04em; }
.kinship-answer p { max-width: 360px; margin: 14px 0 0; color: rgba(255, 255, 255, .74); font-size: 13px; line-height: 1.65; }

.regex-pattern-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 10px; }
.regex-highlight {
  min-height: 180px;
  max-height: 330px;
  overflow: auto;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafcfd;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.7;
}
.regex-highlight mark { padding: 2px 0; border-radius: 3px; background: #ffe18a; color: #5d4300; }
.regex-matches { max-height: 300px; display: grid; gap: 8px; overflow: auto; margin-top: 14px; }
.regex-match { display: grid; gap: 5px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.regex-match strong { color: var(--brand); font-size: 10px; }
.regex-match code { overflow-wrap: anywhere; font-size: 12px; }
.regex-match small { color: var(--muted); line-height: 1.5; }

@media (max-width: 760px) {
  .tool-tabs { overflow-x: auto; }
  .tool-tab { flex: 0 0 auto; }
  .pdf-panel { padding: 20px; }
  .result-grid { grid-template-columns: 1fr; }
  .regex-pattern-row { grid-template-columns: minmax(0, 1fr) 90px; }
  .markdown-layout .code-area, .markdown-preview { min-height: 360px; }
}
