:root {
  --bg-base: #f4f8ff;
  --bg-soft: #e8f5ff;
  --bg-warm: #f4efe5;
  --text: #122033;
  --muted: #5f6d82;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: #ffffff;
  --line: rgba(18, 32, 51, 0.12);
  --brand: #0058d4;
  --brand-strong: #0042a3;
  --accent: #009f86;
  --danger: #b3261e;
  --ring: rgba(0, 88, 212, 0.22);
  --shadow-sm: 0 8px 22px rgba(12, 31, 63, 0.1);
  --shadow-lg: 0 24px 52px rgba(12, 31, 63, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  padding: 28px 24px 30px;
  color: var(--text);
  font-family: "Manrope", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(1000px 640px at -10% -12%, #d8eeff 0%, transparent 48%),
    radial-gradient(920px 560px at 110% -16%, #dff8ef 0%, transparent 48%),
    radial-gradient(980px 760px at 50% 120%, #f8ecda 0%, transparent 52%),
    var(--bg-base);
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  opacity: 0.35;
  background:
    linear-gradient(135deg, rgba(0, 88, 212, 0.07), transparent 36%),
    repeating-linear-gradient(
      -45deg,
      rgba(0, 88, 212, 0.03) 0,
      rgba(0, 88, 212, 0.03) 1px,
      transparent 1px,
      transparent 14px
    );
}

.bg-shape {
  position: fixed;
  pointer-events: none;
  z-index: -1;
  border-radius: 50%;
  filter: blur(58px);
  opacity: 0.8;
  animation: drift 15s ease-in-out infinite alternate;
}

.shape-a {
  width: 320px;
  height: 320px;
  background: rgba(0, 88, 212, 0.2);
  top: 20px;
  right: 34px;
}

.shape-b {
  width: 390px;
  height: 390px;
  background: rgba(0, 159, 134, 0.2);
  bottom: -24px;
  left: -36px;
  animation-delay: 0.7s;
}

.shape-c {
  width: 270px;
  height: 270px;
  background: rgba(246, 177, 66, 0.16);
  top: 42%;
  left: 42%;
  animation-delay: 1.2s;
}

.app {
  max-width: 1360px;
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.hero,
.toolbar,
.panel {
  border: 1px solid var(--line);
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.72));
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(12px);
  animation: rise 0.65s cubic-bezier(0.2, 0.66, 0.3, 1) forwards;
}

.toolbar {
  animation-delay: 0.08s;
}

.workspace .panel:first-child {
  animation-delay: 0.16s;
}

.workspace .panel:last-child {
  animation-delay: 0.24s;
}

.hero {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  padding: 24px 26px;
}

.hero::before {
  content: "";
  position: absolute;
  right: -120px;
  top: -170px;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 88, 212, 0.2) 0%, rgba(0, 88, 212, 0) 72%);
  pointer-events: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid rgba(0, 88, 212, 0.22);
  background: rgba(255, 255, 255, 0.88);
  color: #0050c2;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 12px 0 10px;
  line-height: 1.06;
  letter-spacing: -0.02em;
  font-size: clamp(30px, 4.3vw, 52px);
  font-weight: 800;
  background: linear-gradient(98deg, #06398a 0%, #0058d4 45%, #008f82 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sub {
  margin: 0;
  max-width: 920px;
  color: #44556f;
  font-size: clamp(14px, 1.8vw, 16px);
  line-height: 1.62;
}

.hero-tags {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-tags span {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid rgba(18, 32, 51, 0.14);
  background: rgba(255, 255, 255, 0.82);
  color: #385174;
  font-size: 12px;
  font-weight: 700;
}

.toolbar {
  border-radius: 18px;
  padding: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.toolbar label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.file-picker,
.toolbar button,
.toolbar input[type="text"] {
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  padding: 0 14px;
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
}

.file-picker,
.toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.14s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.file-picker {
  background: linear-gradient(180deg, #ffffff, #f3f9ff);
}

.file-picker:hover,
.toolbar button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.toolbar input[type="text"] {
  min-width: 220px;
  flex: 1 1 220px;
}

#fileInput {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.toolbar button.primary {
  border-color: transparent;
  background: linear-gradient(110deg, var(--brand), var(--accent));
  color: #f6fbff;
}

.toolbar button.primary:hover {
  background: linear-gradient(110deg, #0052c8, #008f79);
}

.toolbar button.secondary {
  background: linear-gradient(180deg, #ffffff, #f4f7fc);
}

.toolbar button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.toolbar button:focus-visible,
.file-picker:focus-visible,
.toolbar input[type="text"]:focus-visible,
textarea:focus-visible,
.panel-copy-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}

.workspace {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.panel {
  border-radius: 18px;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 620px;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(248, 252, 255, 0.72));
}

.panel h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: #24446b;
}

.panel-copy-btn {
  height: 31px;
  min-width: 64px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #ffffff;
  color: #355072;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.2s ease;
}

.panel-copy-btn:hover {
  transform: translateY(-1px);
  background: #f2f8ff;
}

.panel-copy-btn:active {
  transform: translateY(0);
}

textarea {
  width: 100%;
  min-height: 560px;
  border: 0;
  outline: none;
  resize: vertical;
  background: transparent;
  padding: 16px;
  color: #10243f;
  font-family: "JetBrains Mono", "Cascadia Mono", "Consolas", monospace;
  font-size: 14px;
  line-height: 1.63;
}

.preview {
  padding: 18px;
  overflow: auto;
  color: #132641;
}

.preview > *:first-child {
  margin-top: 0;
}

.preview h1,
.preview h2,
.preview h3,
.preview h4,
.preview h5,
.preview h6 {
  margin-top: 1.12em;
  margin-bottom: 0.44em;
  line-height: 1.32;
}

.preview p,
.preview li {
  line-height: 1.72;
}

.preview pre {
  background: linear-gradient(180deg, #f5f8fc, #eff3f9);
  border: 1px solid #d7e0ef;
  padding: 11px;
  border-radius: 10px;
  overflow-x: auto;
}

.preview code {
  font-family: "JetBrains Mono", "Cascadia Mono", "Consolas", monospace;
}

.preview blockquote {
  margin: 0.8em 0;
  padding: 0.15em 0.8em;
  border-left: 3px solid #8eb6ed;
  color: #486188;
}

.preview table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.85em 0;
}

.preview th,
.preview td {
  border: 1px solid #c9d6ea;
  padding: 8px;
  text-align: left;
}

.preview th {
  background: #f0f5fd;
}

.status {
  margin: 0;
  min-height: 22px;
  padding: 2px 2px 0;
  color: var(--muted);
  font-size: 14px;
}

.status.error {
  color: var(--danger);
  font-weight: 700;
}

.pdf-export,
.word-export {
  position: absolute;
  left: 16px;
  top: 16px;
  z-index: 99999;
  width: 794px;
  padding: 42px 46px;
  background: #ffffff;
  color: #1f1f1f;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

.pdf-export h1,
.pdf-export h2,
.pdf-export h3,
.pdf-export h4,
.pdf-export h5,
.pdf-export h6,
.word-export h1,
.word-export h2,
.word-export h3,
.word-export h4,
.word-export h5,
.word-export h6 {
  margin-top: 1.15em;
  margin-bottom: 0.45em;
  line-height: 1.3;
  break-after: avoid;
}

.pdf-export p,
.pdf-export li,
.word-export p,
.word-export li {
  line-height: 1.6;
}

.pdf-export pre,
.word-export pre {
  background: #f3f3f3;
  padding: 10px;
  border-radius: 6px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.pdf-export table,
.word-export table {
  border-collapse: collapse;
  width: 100%;
  margin: 10px 0;
}

.pdf-export th,
.pdf-export td,
.word-export th,
.word-export td {
  border: 1px solid #cfcfcf;
  padding: 8px;
  text-align: left;
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes drift {
  from {
    transform: translateY(0) scale(1);
  }

  to {
    transform: translateY(-20px) scale(1.04);
  }
}

@media (max-width: 1120px) {
  .toolbar {
    gap: 9px;
  }

  .toolbar input[type="text"] {
    flex-basis: 180px;
  }
}

@media (max-width: 920px) {
  body {
    padding: 14px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .panel {
    min-height: 440px;
  }

  textarea {
    min-height: 360px;
  }

  .hero {
    border-radius: 20px;
    padding: 20px;
  }

  .toolbar {
    border-radius: 14px;
    padding: 12px;
  }

  .toolbar input[type="text"] {
    min-width: 0;
    flex: 1 1 100%;
  }
}
