:root {
  color-scheme: light;
  --paper: #edf7f3;
  --panel: rgba(255, 253, 250, 0.92);
  --ink: #1d2521;
  --muted: #66706a;
  --line: #d8d1c3;
  --green: #0f6b57;
  --green-dark: #08483a;
  --blue: #245c9a;
  --red: #b33a2f;
  --amber: #c68722;
  --shadow: 0 18px 48px rgba(36, 45, 40, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #dff8f1 0%, #92c8d2 48%, #315f76 100%);
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
}

.ocean-background {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(243, 250, 246, 0.88) 0%, rgba(125, 198, 204, 0.72) 36%, rgba(33, 92, 115, 0.86) 100%);
}

.ocean-background canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0;
}

.workspace {
  display: grid;
  gap: 22px;
}

.masthead {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 18px;
}

.masthead-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p,
dl {
  margin: 0;
}

h1 {
  font-size: clamp(36px, 7vw, 78px);
  line-height: 0.94;
  letter-spacing: 0;
}

.title-art-heading {
  line-height: 0;
}

.title-art {
  display: block;
  width: 100%;
  max-width: min(100%, 720px);
  height: auto;
  filter:
    drop-shadow(0 8px 16px rgba(4, 42, 60, 0.24))
    drop-shadow(0 1px 0 rgba(255, 255, 255, 0.34));
}

.health {
  min-width: 112px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.parser-form {
  display: grid;
  gap: 10px;
}

label {
  font-size: 14px;
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 142px;
  resize: vertical;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 16px;
  font: inherit;
  line-height: 1.55;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

textarea:focus {
  outline: 3px solid rgba(15, 107, 87, 0.24);
  outline-offset: 2px;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 0 18px;
  color: var(--ink);
  background: var(--panel);
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 4px 4px 0 var(--ink);
}

.button:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
  box-shadow: none;
}

.primary,
.download {
  background: var(--green);
  color: white;
}

.secondary {
  color: var(--blue);
}

.donation-trigger {
  background: #fff2b8;
}

.status {
  min-height: 24px;
  color: var(--muted);
  font-weight: 700;
}

.status[data-tone="ok"] {
  color: var(--green);
}

.status[data-tone="pending"] {
  color: var(--amber);
}

.status[data-tone="error"] {
  color: var(--red);
}

.result {
  display: grid;
  grid-template-columns: minmax(180px, 280px) 1fr;
  gap: 18px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.cover-frame {
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #e6dfd1;
}

.cover-frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.result-body {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 16px;
}

h2 {
  overflow-wrap: anywhere;
  font-size: clamp(22px, 4vw, 38px);
  line-height: 1.12;
  letter-spacing: 0;
}

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

.meta div {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.download {
  width: fit-content;
}

.download[aria-busy="true"] {
  cursor: wait;
  opacity: 0.8;
}

.download-progress {
  display: grid;
  gap: 8px;
  max-width: 460px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.progress-meta span {
  overflow-wrap: anywhere;
}

progress {
  width: 100%;
  height: 16px;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--panel);
}

progress::-webkit-progress-bar {
  background: #e6dfd1;
}

progress::-webkit-progress-value {
  background: var(--green);
}

progress::-moz-progress-bar {
  background: var(--green);
}

.donation-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(29, 37, 33, 0.36);
}

.donation-overlay[hidden] {
  display: none;
}

.donation-modal {
  position: relative;
  width: min(100%, 440px);
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--panel);
  padding: 28px;
  box-shadow: 8px 8px 0 var(--ink);
  backdrop-filter: blur(14px);
}

.donation-modal h2 {
  font-size: clamp(28px, 6vw, 44px);
}

.donation-copy {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.65;
}

.donation-close {
  position: absolute;
  top: 12px;
  right: 12px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--ink);
  padding: 0 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.wechat-qr {
  display: block;
  width: min(100%, 288px);
  margin: 18px auto;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: white;
}

.wechat-id {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ddfbe8;
  padding: 12px 14px;
}

.wechat-id span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.wechat-id strong {
  overflow-wrap: anywhere;
  font-size: 18px;
}

@media (max-width: 680px) {
  .shell {
    width: min(100% - 20px, 1040px);
    padding: 22px 0;
  }

  .masthead {
    align-items: start;
    flex-direction: column;
  }

  .masthead-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .health {
    text-align: left;
  }

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

  .cover-frame {
    max-height: 360px;
  }

  .title-art {
    max-width: min(100%, 390px);
  }
}
