.tool-hero {
  text-align: center;
  padding: 2.2rem 0 1rem;
}
.tool-hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  margin: 0 0 0.75rem;
  background: var(--grad-title);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.tool-hero p {
  color: var(--text-color);
  opacity: 0.9;
  margin: 0;
}
.tool-shell {
  max-width: 1100px;
  margin: 0 auto;
  background: var(--card-bg);
  border: 1px solid var(--header-border);
  border-radius: 16px;
  padding: 28px 28px 20px;
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
}
.upload-box {
  text-align: center;
  margin-bottom: 20px;
}
.upload-box input[type="file"] {
  display: none;
}
.file-name {
  display: block;
  margin-top: 10px;
  color: var(--text-color);
  font-size: 0.95rem;
}
.btn-group {
  display: flex;
  gap: 12px;
  margin: 16px 0;
  flex-wrap: wrap;
}
.btn-run {
  padding: 10px 28px;
  background: linear-gradient(135deg, #79627a, #9c5b5b);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-run:hover {
  opacity: 0.88;
}
.btn-run:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-clear {
  padding: 10px 28px;
  background: transparent;
  color: var(--text-color);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-clear:hover {
  background: var(--hover);
}
#status {
  margin-top: 12px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.92rem;
  display: none;
}
#status.info {
  display: block;
  background: rgba(121, 98, 122, 0.12);
  color: #79627a;
}
#status.err {
  display: block;
  background: rgba(220, 53, 69, 0.12);
  color: #dc3545;
}
.hint {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--footer-text);
  line-height: 1.6;
}
[data-theme="dark"] .hint {
  background: rgba(255, 255, 255, 0.04);
}

/* 结果区域 */
.result-section {
  margin-top: 24px;
}
.result-section h2 {
  font-size: 1.3rem;
  margin-bottom: 16px;
  background: var(--grad-title);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.macro-summary {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.summary-card {
  flex: 1;
  min-width: 140px;
  padding: 16px;
  background: var(--card-bg);
  border: 1px solid var(--header-border);
  border-radius: 12px;
  text-align: center;
  backdrop-filter: blur(4px);
}
.summary-card .num {
  font-size: 2rem;
  font-weight: 700;
  color: #79627a;
}
.summary-card .label {
  font-size: 0.85rem;
  color: var(--footer-text);
  margin-top: 4px;
}

.module-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.module-card {
  border: 1px solid var(--header-border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--card-bg);
  backdrop-filter: blur(4px);
}
.module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: rgba(121, 98, 122, 0.08);
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}
.module-header:hover {
  background: rgba(121, 98, 122, 0.14);
}
.module-header .module-name {
  font-weight: 600;
  font-size: 1.05rem;
}
.module-header .module-type {
  font-size: 0.8rem;
  padding: 2px 10px;
  border-radius: 20px;
  background: rgba(121, 98, 122, 0.15);
  color: #79627a;
}
.module-header .module-type.document {
  background: rgba(0, 123, 255, 0.12);
  color: #007bff;
}
.module-header .module-type.module {
  background: rgba(40, 167, 69, 0.12);
  color: #28a745;
}
.module-header .module-type.class {
  background: rgba(255, 193, 7, 0.15);
  color: #d4a017;
}
.module-body {
  padding: 0 18px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}
.module-card.open .module-body {
  max-height: 5000px;
  padding: 14px 18px;
}
.macro-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--header-border);
}
.macro-item:last-child {
  border-bottom: none;
}
.macro-keyword {
  font-weight: 600;
  font-size: 0.85rem;
  padding: 2px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}
.macro-keyword.sub {
  background: rgba(0, 123, 255, 0.12);
  color: #007bff;
}
.macro-keyword.function {
  background: rgba(40, 167, 69, 0.12);
  color: #28a745;
}
.macro-keyword.property {
  background: rgba(255, 193, 7, 0.15);
  color: #d4a017;
}
.macro-keyword.event {
  background: rgba(220, 53, 69, 0.12);
  color: #dc3545;
}
.macro-name {
  font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
  font-size: 0.95rem;
}
.macro-params {
  font-size: 0.82rem;
  color: var(--footer-text);
}
.no-macro {
  padding: 20px;
  text-align: center;
  color: var(--footer-text);
  font-size: 0.95rem;
}
.raw-source {
  margin-top: 10px;
  padding: 12px;
  background: var(--code-bg);
  border-radius: 8px;
  font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 400px;
  overflow-y: auto;
  color: var(--code-text);
}
.expand-btn {
  font-size: 0.8rem;
  color: #79627a;
  cursor: pointer;
  border: none;
  background: none;
  text-decoration: underline;
  padding: 4px 0;
}
.expand-btn:hover {
  color: #9c5b5b;
}
