:root {
  --bg: #fff8f4;
  --panel: rgba(255, 253, 250, 0.84);
  --panel-strong: rgba(255, 255, 255, 0.92);
  --line: rgba(255, 255, 255, 0.78);
  --line-strong: rgba(194, 132, 112, 0.26);
  --text: #5b4039;
  --muted: #806962;
  --accent: #b86554;
  --accent-2: #4c9288;
  --shadow: 0 24px 60px rgba(174, 116, 93, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Avenir Next", "SF Pro Display", "PingFang TC", "Noto Sans TC", sans-serif;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 12%, rgba(255, 255, 255, 0.94), transparent 26%),
    radial-gradient(circle at 84% 14%, rgba(255, 220, 200, 0.72), transparent 25%),
    radial-gradient(circle at 14% 88%, rgba(199, 239, 229, 0.64), transparent 25%),
    linear-gradient(180deg, #fffbf8 0%, #fff2ea 52%, #fce6dc 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 999px;
  pointer-events: none;
  filter: blur(36px);
  z-index: 0;
}

body::before {
  width: 280px;
  height: 280px;
  left: -92px;
  top: 100px;
  background: rgba(183, 235, 222, 0.48);
}

body::after {
  width: 330px;
  height: 330px;
  right: -108px;
  bottom: 20px;
  background: rgba(255, 205, 178, 0.5);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

button {
  max-width: 100%;
  white-space: normal;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 72px;
}

.topbar,
.nav-links,
.section-head,
.result-title-row,
.button-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.topbar,
.section-head,
.result-title-row {
  justify-content: space-between;
}

.topbar {
  margin-bottom: 18px;
}

.brand-pill,
.top-link,
.ghost-btn,
.mini-btn {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.brand-pill,
.top-link {
  border-radius: 999px;
  padding: 12px 18px;
  color: var(--muted);
  font-size: 14px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 32px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 248, 242, 0.7)),
    linear-gradient(135deg, rgba(238, 251, 247, 0.72), rgba(255, 240, 228, 0.44));
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) 340px;
  gap: 24px;
  padding: clamp(24px, 4vw, 34px);
}

.hero > *,
.workspace > *,
.form-panel,
.result-panel,
.draft-panel {
  min-width: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 16px;
  max-width: 780px;
  font-size: 4.35rem;
  line-height: 1.02;
  letter-spacing: 0;
  overflow-wrap: normal;
  word-break: keep-all;
}

.mobile-title-break {
  display: none;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.22rem, 3vw, 1.55rem);
}

h3 {
  margin-bottom: 0;
  font-size: 1rem;
}

.lead,
.hero-note,
.section-note,
li,
output,
pre {
  color: var(--muted);
  line-height: 1.78;
}

.lead {
  margin-bottom: 0;
  max-width: 760px;
  font-size: 1.02rem;
}

.hero-note {
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.56);
}

.hero-note h2 {
  margin-bottom: 10px;
  font-size: 1.05rem;
}

.hero-note ul {
  margin: 0;
  padding-left: 20px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) 380px;
  gap: 24px;
  margin-top: 24px;
}

.form-panel,
.result-panel,
.draft-panel {
  padding: 28px;
}

.section-head {
  align-items: end;
  margin-bottom: 20px;
}

.section-kicker {
  margin: 0 0 8px;
  color: var(--accent-2);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
  min-width: 0;
}

label span {
  font-size: 0.92rem;
}

.import-card {
  display: grid;
  gap: 14px;
  margin-bottom: 20px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.48);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.import-card.is-dragover {
  border-color: rgba(76, 146, 136, 0.46);
  background: rgba(238, 251, 247, 0.68);
  box-shadow: 0 0 0 4px rgba(76, 146, 136, 0.12);
}

.import-card .full-field {
  margin-top: 0;
}

.markdown-field textarea {
  min-height: 210px;
}

.drop-hint,
.collision-warning {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.file-input {
  display: none;
}

.import-actions {
  justify-content: flex-start;
}

.import-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.import-status.is-ok {
  color: var(--accent-2);
  font-weight: 700;
}

.import-status.is-warn {
  color: var(--accent);
  font-weight: 700;
}

.collision-warning {
  margin-top: 10px;
}

.collision-warning.is-ok {
  color: var(--accent-2);
  font-weight: 700;
}

.collision-warning.is-warn {
  color: var(--accent);
  font-weight: 700;
}

.full-field {
  margin-top: 16px;
}

input,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(194, 132, 112, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  outline: none;
}

input {
  min-height: 46px;
  padding: 12px 14px;
}

textarea {
  min-height: 124px;
  padding: 14px 16px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: rgba(184, 101, 84, 0.44);
  box-shadow: 0 0 0 4px rgba(184, 101, 84, 0.12);
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.option-grid label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.54);
  color: var(--muted);
  font-size: 0.92rem;
}

.option-grid input {
  width: 18px;
  min-height: auto;
  height: 18px;
  accent-color: var(--accent);
}

.ghost-btn,
.mini-btn {
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.ghost-btn {
  padding: 11px 16px;
  font-weight: 700;
}

.mini-btn {
  padding: 8px 12px;
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 800;
}

.ghost-btn:hover,
.mini-btn:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.result-stack {
  display: grid;
  gap: 14px;
}

.result-card {
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 22px;
  background: var(--panel-strong);
  min-width: 0;
}

output,
pre {
  display: block;
  margin: 12px 0 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  font-size: 0.94rem;
}

pre,
#html-output {
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
}

.draft-panel {
  margin-top: 24px;
}

#html-output {
  min-height: 480px;
  line-height: 1.6;
  white-space: pre;
}

@media (max-width: 920px) {
  .hero,
  .workspace {
    grid-template-columns: 1fr;
  }

  .hero-note {
    padding: 18px;
  }
}

@media (max-width: 680px) {
  .page-shell {
    width: min(100vw - 24px, 1180px);
    padding-top: 18px;
  }

  .panel {
    border-radius: 26px;
  }

  .hero,
  .form-panel,
  .result-panel,
  .draft-panel {
    padding: 20px;
  }

  .topbar,
  .nav-links {
    align-items: stretch;
  }

  .section-head,
  .result-title-row,
  .button-row {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .brand-pill,
  .top-link,
  .ghost-btn,
  .mini-btn {
    justify-content: center;
    text-align: center;
  }

  h1 {
    font-size: 2.35rem;
  }

  .mobile-title-break {
    display: block;
  }

  .lead {
    font-size: 0.96rem;
  }

  .field-grid,
  .option-grid {
    grid-template-columns: 1fr;
  }
}
