:root {
  --bg: #f3efe5;
  --paper: rgba(255, 252, 245, 0.82);
  --ink: #14281d;
  --muted: #5d6b63;
  --line: rgba(20, 40, 29, 0.12);
  --accent: #ea5b2a;
  --accent-strong: #c74418;
  --accent-soft: #ffd6c8;
  --shadow: 0 24px 70px rgba(52, 41, 27, 0.15);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(234, 91, 42, 0.22), transparent 28%),
    radial-gradient(circle at right center, rgba(20, 40, 29, 0.12), transparent 24%),
    linear-gradient(135deg, #f7f2e7 0%, #efe5d4 55%, #eadcca 100%);
}

body {
  position: relative;
  overflow-x: hidden;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 18px 18px;
  mask-image: radial-gradient(circle at center, black 40%, transparent 100%);
}

.shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 72px;
}

.hero {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
  align-items: stretch;
  margin-bottom: 22px;
}

.hero-copy,
.hero-card,
.panel {
  background: var(--paper);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 36px;
  border-radius: var(--radius-xl);
  animation: fadeUp 0.7s ease;
}

.eyebrow,
.panel-tag {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-strong);
  font-weight: 700;
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.04;
}

.hero-text {
  max-width: 640px;
  margin: 18px 0 0;
  font-size: 16px;
  line-height: 1.8;
  color: var(--muted);
}

.hero-card {
  border-radius: var(--radius-xl);
  padding: 24px;
  display: grid;
  gap: 14px;
  animation: fadeUp 0.8s ease;
}

.hero-stat {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid var(--line);
}

.hero-stat span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.hero-stat strong {
  font-size: 22px;
}

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

.panel {
  border-radius: var(--radius-xl);
  padding: 24px;
  animation: fadeUp 0.9s ease;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.panel-head h2 {
  margin: 0;
  font-size: 28px;
}

.field-label {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
}

.textarea {
  width: 100%;
  min-height: 152px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  resize: vertical;
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.textarea:focus {
  outline: none;
  border-color: rgba(234, 91, 42, 0.5);
  box-shadow: 0 0 0 4px rgba(234, 91, 42, 0.12);
  transform: translateY(-1px);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

button {
  appearance: none;
  border: none;
  cursor: pointer;
  font: inherit;
  border-radius: 999px;
  padding: 12px 18px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

.primary-btn {
  background: var(--accent);
  color: #fffdf9;
  box-shadow: 0 12px 24px rgba(234, 91, 42, 0.28);
}

.secondary-btn {
  background: #fff7f2;
  color: var(--accent-strong);
  border: 1px solid rgba(234, 91, 42, 0.18);
}

.ghost-btn {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.preview-card,
.result-card,
.upload-box,
.image-preview-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.62);
}

.preview-card {
  margin-top: 20px;
  min-height: 380px;
  display: grid;
  place-items: center;
  padding: 20px;
}

.qrcode-box {
  width: 100%;
  min-height: 300px;
  display: grid;
  place-items: center;
}

.qrcode-box canvas,
.qrcode-box img {
  width: min(100%, 320px);
  height: auto;
  border-radius: 20px;
  background: #ffffff;
  padding: 12px;
  box-shadow: 0 14px 40px rgba(20, 40, 29, 0.12);
}

.muted {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.upload-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.upload-box:hover {
  transform: translateY(-1px);
  border-color: rgba(234, 91, 42, 0.35);
  background: rgba(255, 247, 242, 0.92);
}

.upload-title {
  font-size: 18px;
  font-weight: 700;
}

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

.decode-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 18px;
}

.image-preview-wrap {
  min-height: 220px;
  display: grid;
  place-items: center;
  padding: 16px;
}

.preview-image {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  border-radius: 14px;
}

.result-card {
  padding: 16px;
}

.result-text {
  min-height: 140px;
}

.result-type {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.hidden {
  display: none !important;
}

.text-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
}

.text-panel {
  width: min(840px, 100%);
  padding: 28px;
  border-radius: var(--radius-xl);
  background: var(--paper);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: var(--shadow);
  animation: fadeUp 0.7s ease;
}

.text-panel h1 {
  margin: 0 0 18px;
  font-size: clamp(30px, 5vw, 52px);
}

.text-page-textarea {
  min-height: 420px;
  font-size: 18px;
  line-height: 1.8;
  margin-bottom: 8px;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

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

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

  .shell {
    width: min(100% - 20px, 1200px);
    padding-top: 18px;
  }

  .hero-copy,
  .hero-card,
  .panel {
    padding: 20px;
  }

  .panel-head {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .hero-copy h1 {
    font-size: 34px;
  }

  .panel-head h2 {
    font-size: 24px;
  }

  .action-row {
    flex-direction: column;
  }

  button {
    width: 100%;
  }
}
