:root {
  color-scheme: light;
  --bg: #f5f2e9;
  --bg-deep: #dce9dc;
  --ink: #18332a;
  --muted: #6d7a67;
  --leaf: #1f7a55;
  --leaf-dark: #0e5138;
  --leaf-soft: #c8ddbf;
  --rice: #fffdf5;
  --paper: #fff8e6;
  --paper-strong: #f2dfb8;
  --cinnabar: #b83f2f;
  --water: #87b8ac;
  --shadow: 0 22px 70px rgba(28, 59, 45, 0.2);
  --small-shadow: 0 10px 26px rgba(31, 80, 58, 0.16);
  --radius: 8px;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui,
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 15% 12%, rgba(184, 63, 47, 0.12), transparent 24%),
    radial-gradient(circle at 88% 8%, rgba(31, 122, 85, 0.16), transparent 28%),
    linear-gradient(135deg, var(--bg), var(--bg-deep));
  color: var(--ink);
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(360px, 0.94fr) minmax(360px, 1.06fr);
  gap: 56px;
  align-items: center;
  padding: 42px 0;
  overflow-x: hidden;
}

.control-panel {
  padding: 10px 0;
}

.brand-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--leaf-dark);
  font-weight: 800;
  margin-bottom: 42px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--paper);
  background: linear-gradient(135deg, var(--leaf), var(--leaf-dark));
  box-shadow: var(--small-shadow);
}

.brand-name {
  letter-spacing: 0;
}

.intro h1 {
  max-width: 680px;
  margin: 0;
  font-size: clamp(34px, 4.35vw, 58px);
  line-height: 1.08;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.intro p {
  max-width: 540px;
  margin: 22px 0 34px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.8;
}

.generator-form {
  display: grid;
  gap: 22px;
}

.field-group,
.choice-group {
  border: 0;
  padding: 0;
  margin: 0;
}

.field-group > span,
.choice-group legend {
  display: block;
  margin-bottom: 10px;
  color: var(--leaf-dark);
  font-size: 14px;
  font-weight: 800;
}

.field-group input {
  width: 100%;
  min-height: 54px;
  border: 1px solid rgba(31, 80, 58, 0.22);
  border-radius: var(--radius);
  padding: 0 16px;
  background: rgba(255, 253, 245, 0.78);
  color: var(--ink);
  outline: none;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
}

.field-group input::placeholder {
  color: rgba(109, 122, 103, 0.72);
}

.field-group input:focus {
  border-color: var(--leaf);
  box-shadow: 0 0 0 4px rgba(31, 122, 85, 0.12);
}

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

.segmented label,
.tone-grid label {
  cursor: pointer;
}

.segmented input,
.tone-grid input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  min-height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(31, 80, 58, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 253, 245, 0.64);
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.segmented input:checked + span {
  border-color: var(--leaf);
  background: var(--leaf);
  color: var(--rice);
}

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

.tone-grid span {
  min-height: 86px;
  display: grid;
  align-content: center;
  gap: 6px;
  border: 1px solid rgba(31, 80, 58, 0.18);
  border-radius: var(--radius);
  padding: 14px;
  background: rgba(255, 253, 245, 0.66);
  color: var(--ink);
}

.tone-grid strong,
.tone-grid small {
  display: block;
}

.tone-grid strong {
  font-size: 15px;
}

.tone-grid small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.tone-grid input:checked + span {
  border-color: var(--leaf);
  background: linear-gradient(135deg, rgba(255, 253, 245, 0.95), #e5f0df);
  box-shadow: var(--small-shadow);
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.primary-button,
.secondary-button {
  min-height: 50px;
  border: 0;
  border-radius: var(--radius);
  padding: 0 22px;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.primary-button {
  flex: 1 1 180px;
  background: var(--leaf-dark);
  color: var(--rice);
  box-shadow: 0 16px 32px rgba(14, 81, 56, 0.2);
}

.secondary-button {
  flex: 0 0 auto;
  background: var(--paper);
  color: var(--leaf-dark);
  border: 1px solid rgba(31, 80, 58, 0.18);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.primary-button:active,
.secondary-button:active {
  transform: translateY(0);
}

.status {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.share-panel {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(31, 80, 58, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 253, 245, 0.58);
}

.share-panel[hidden] {
  display: none;
}

.share-preview {
  display: grid;
  place-items: center;
  padding: 10px;
  border-radius: var(--radius);
  background: rgba(220, 233, 220, 0.56);
}

.share-preview img {
  width: min(100%, 300px);
  border-radius: 10px;
  box-shadow: var(--small-shadow);
  background: var(--rice);
}

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

.share-links a,
.share-links button {
  min-height: 44px;
  padding: 0 12px;
  font-size: 14px;
  text-align: center;
  text-decoration: none;
  display: grid;
  place-items: center;
}

.share-url {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.preview-panel {
  display: grid;
  place-items: center;
}

.phone-frame {
  width: min(100%, 440px);
  padding: 16px;
  border-radius: 30px;
  background: rgba(255, 253, 245, 0.52);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.75);
}

.festival-card {
  position: relative;
  min-height: 690px;
  overflow: hidden;
  border-radius: 22px;
  padding: 28px;
  background:
    linear-gradient(160deg, rgba(255, 248, 230, 0.96), rgba(235, 244, 226, 0.94)),
    var(--paper);
  border: 1px solid rgba(31, 80, 58, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.festival-card::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(31, 122, 85, 0.2);
  border-radius: 18px;
  pointer-events: none;
}

.card-header,
.card-footer,
.card-copy,
.zongzi-hero {
  position: relative;
  z-index: 1;
}

.card-header,
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.card-header > *,
.card-footer > * {
  min-width: 0;
}

.seal {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--cinnabar);
  color: var(--paper);
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: 0 8px 18px rgba(184, 63, 47, 0.24);
}

.date-line,
.card-footer {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.date-line {
  display: block;
  flex: 1;
  text-align: right;
  line-height: 1.5;
}

.zongzi-hero {
  width: 180px;
  height: 160px;
  margin: 54px auto 42px;
}

.leaf,
.rice,
.cord {
  position: absolute;
  display: block;
}

.leaf {
  width: 118px;
  height: 130px;
  top: 18px;
  border-radius: 85% 12% 80% 14%;
  background: linear-gradient(135deg, var(--leaf), var(--leaf-dark));
  box-shadow: 0 16px 24px rgba(31, 80, 58, 0.18);
}

.leaf-left {
  left: 16px;
  transform: rotate(-23deg);
}

.leaf-right {
  right: 16px;
  transform: rotate(203deg);
  background: linear-gradient(135deg, #7cac67, var(--leaf));
}

.rice {
  left: 50%;
  top: 36px;
  width: 98px;
  height: 98px;
  transform: translateX(-50%) rotate(45deg);
  border-radius: 16px 42px 16px 42px;
  background: var(--rice);
  border: 1px solid rgba(31, 80, 58, 0.18);
}

.cord {
  left: 28px;
  right: 28px;
  top: 84px;
  height: 8px;
  border-radius: 99px;
  background: repeating-linear-gradient(
    90deg,
    #b83f2f 0 16px,
    #f0b74a 16px 32px,
    #1f7a55 32px 48px,
    #2f668f 48px 64px,
    #623f7c 64px 80px
  );
  box-shadow: 0 6px 14px rgba(31, 80, 58, 0.16);
}

.card-copy {
  text-align: center;
}

.card-kicker {
  margin: 0 0 14px;
  color: var(--cinnabar);
  font-size: 15px;
  font-weight: 900;
}

.card-copy h2 {
  margin: 0 auto;
  max-width: 310px;
  color: var(--leaf-dark);
  font-size: 32px;
  line-height: 1.18;
  letter-spacing: 0;
}

.card-copy p:last-child {
  max-width: 314px;
  margin: 22px auto 0;
  color: #31493d;
  font-size: 18px;
  line-height: 1.9;
  font-weight: 600;
}

.card-footer {
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: 28px;
  z-index: 1;
  padding-top: 18px;
  border-top: 1px solid rgba(31, 80, 58, 0.16);
}

.card-ornament {
  position: absolute;
  z-index: 0;
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: rgba(31, 122, 85, 0.14);
  border: 1px solid rgba(31, 122, 85, 0.12);
  font-size: 44px;
  font-weight: 900;
}

.top-left {
  left: -22px;
  top: 90px;
}

.bottom-right {
  right: -26px;
  bottom: 84px;
}

.ripple {
  position: absolute;
  height: 12px;
  border: 2px solid rgba(135, 184, 172, 0.36);
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  border-radius: 50%;
}

.ripple-one {
  width: 210px;
  left: 24px;
  bottom: 134px;
}

.ripple-two {
  width: 164px;
  right: 34px;
  bottom: 112px;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    gap: 34px;
    align-items: start;
    padding: 28px 0 42px;
  }

  .brand-row {
    margin-bottom: 28px;
  }

  .intro h1 {
    max-width: 100%;
    font-size: 34px;
    line-height: 1.16;
  }

  .intro p {
    font-size: 16px;
    margin-bottom: 26px;
  }

  .preview-panel {
    order: 0;
  }

  .phone-frame {
    width: min(100%, 390px);
  }

  .festival-card {
    min-height: 620px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: 100%;
    padding: 28px 16px 42px;
  }

  .segmented {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .intro h1 {
    font-size: 28px;
    line-height: 1.2;
  }

  .intro p {
    max-width: 100%;
  }

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

  .actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .share-links {
    grid-template-columns: 1fr;
  }

  .secondary-button,
  .primary-button {
    width: 100%;
  }

  .phone-frame {
    width: 100%;
    padding: 10px;
    border-radius: 24px;
  }

  .festival-card {
    min-height: 594px;
    border-radius: 18px;
    padding: 22px;
  }

  .festival-card::before {
    inset: 14px;
  }

  .zongzi-hero {
    margin: 40px auto 34px;
    transform: scale(0.9);
  }

  .card-copy h2 {
    font-size: 25px;
  }

  .card-copy p:last-child {
    font-size: 15px;
    line-height: 1.85;
  }

  .card-footer {
    left: 22px;
    right: 22px;
    bottom: 22px;
  }

  .date-line {
    max-width: none;
    font-size: 12px;
  }

  #card-signature {
    text-align: right;
  }
}
