.tool-header h1 {
  font-size: clamp(28px, 5vw, 40px);
}

.nametag-layout {
  display: grid;
  gap: 24px;
  margin-top: 24px;
}

.nametag-config-panel {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.nametag-preview-panel {
  overflow: hidden;
}

.nametag-preview-head {
  padding-bottom: 16px;
}

.nametag-preview-meta {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}

.nametag-section {
  display: grid;
  gap: 12px;
}

.nametag-section-title {
  margin: 0;
  font-size: 15px;
  color: var(--text);
}

.nametag-section-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.nametag-section-row-top {
  align-items: center;
}

.nametag-section-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.nametag-template-note {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

.nametag-clear-btn {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--danger);
  font-size: 12px;
  cursor: pointer;
}

.file-upload-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  padding: 24px 16px;
  border: 1px dashed rgba(58, 153, 222, 0.28);
  border-radius: var(--radius-sm);
  background: rgba(248, 252, 255, 0.74);
  cursor: pointer;
  text-align: center;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.file-upload-card:hover,
.file-upload-card:focus-visible {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 22px rgba(58, 153, 222, 0.08);
}

.file-upload-card.has-file {
  border-style: solid;
  border-color: var(--accent);
  background: rgba(58, 153, 222, 0.05);
}

.upload-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.upload-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.nametag-textarea {
  width: 100%;
  min-height: 190px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(248, 252, 255, 0.98);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.6;
  outline: none;
  resize: vertical;
}

.nametag-textarea:focus {
  border-color: rgba(31, 123, 193, 0.42);
  box-shadow: 0 0 0 4px rgba(58, 153, 222, 0.12);
}

.nametag-spec-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(249, 250, 251, 0.86);
}

.nametag-spec-title {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.nametag-spec-copy {
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
}

.nametag-generate-btn {
  margin-top: auto;
}

.preview-board {
  max-height: 600px;
  display: flex;
  flex-direction: column;
  gap: 40px;
  align-items: center;
  padding: 32px 24px;
  overflow-y: auto;
  border-top: 1px solid var(--line);
  background: rgba(244, 245, 247, 0.72);
}

.nametag-empty {
  padding: 60px 0;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}

.a4-page {
  width: 100%;
  max-width: 460px;
  display: grid;
  box-sizing: border-box;
  aspect-ratio: 210 / 297;
  padding: 4.54% 7.14%;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(5, 1fr);
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.a4-cell {
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  border: 1px dashed #d1d5db;
  container-type: inline-size;
}

.a4-cell.empty-cell {
  background: repeating-linear-gradient(45deg, #f9fafb, #f9fafb 10px, #f3f4f6 10px, #f3f4f6 20px);
}

.preview-logo {
  position: absolute;
  top: 12%;
  left: 8%;
  height: 20%;
  max-width: 40%;
  object-fit: contain;
  object-position: left top;
}

.preview-content {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-name {
  font-family: "KaiTi", "楷体", STKaiti, serif;
  font-weight: 700;
  color: #111;
  line-height: 1.2;
  text-align: center;
  white-space: pre-wrap;
}

.render-zone {
  position: fixed;
  top: -9999px;
  left: -9999px;
}

.hd-canvas {
  position: relative;
  width: 1800px;
  height: 1080px;
  background: #fff;
}

.hd-logo {
  display: none;
  position: absolute;
  top: 12%;
  left: 8%;
  height: 20%;
  max-width: 40%;
  object-fit: contain;
  object-position: left top;
}

.hd-canvas-body {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hd-name {
  font-family: "KaiTi", "楷体", STKaiti, serif;
  font-weight: 700;
  color: #000;
  line-height: 1.2;
  text-align: center;
  white-space: pre-wrap;
}

.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
}

.spinner {
  width: 36px;
  height: 36px;
  margin-bottom: 16px;
  border: 3px solid #e5e7eb;
  border-top: 3px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-title {
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.loading-status {
  font-size: 13px;
  color: var(--muted);
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@media (min-width: 960px) {
  .nametag-layout {
    grid-template-columns: minmax(300px, 1fr) minmax(400px, 1.5fr);
    align-items: start;
  }
}

@media (max-width: 760px) {
  .nametag-config-panel {
    padding: 18px;
  }

  .preview-board {
    padding: 24px 16px;
  }

  .nametag-section-row {
    align-items: center;
  }
}
