:root {
  --sky: #87dce8;
  --deep-sky: #2b9caf;
  --ink: #185a66;
  --paper: #fffdf8;
  --line: rgba(24, 90, 102, 0.22);
  --accent: #ef6a4e;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--sky);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }

body {
  min-width: 0;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 9% 11%, rgba(255,255,255,.48), transparent 23rem),
    radial-gradient(circle at 84% 18%, rgba(255,244,185,.4), transparent 25rem),
    linear-gradient(135deg, #86dce8 0%, #b0eaf0 48%, #84d6e2 100%);
}

body::before, body::after {
  position: fixed;
  z-index: -1;
  width: 19rem;
  height: 19rem;
  border-radius: 49% 51% 45% 55% / 55% 43% 57% 45%;
  content: "";
  filter: blur(1px);
  opacity: .42;
}

body::before { top: 14%; left: -10rem; background: #fff3ae; }
body::after { right: -10rem; bottom: 10%; background: #f6a8a1; }

button, input { font: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

.page-shell { width: min(100%, 760px); margin: 0 auto; padding: 48px 20px 72px; }
.intro { padding: 14px 4px 25px; text-align: center; }
.eyebrow { margin: 0 0 10px; color: rgba(24,90,102,.78); font-family: Georgia, serif; font-size: 12px; letter-spacing: .16em; }
h1, h2 { font-family: Georgia, "Songti SC", serif; font-weight: 400; letter-spacing: .035em; }
h1 { margin: 0; font-size: clamp(31px, 8vw, 48px); line-height: 1.15; }
.intro p:last-child { margin: 12px 0 0; font-size: 15px; }

.form-card, .result { border: 1px solid rgba(255,255,255,.78); border-radius: 24px; background: rgba(255,253,248,.88); box-shadow: 0 18px 45px rgba(28,103,117,.15); backdrop-filter: blur(14px); }
.form-card { padding: clamp(24px, 5vw, 38px); }
.field { margin: 0 0 26px; padding: 0; border: 0; }
.field > label, legend { display: block; margin-bottom: 10px; font-size: 15px; font-weight: 650; line-height: 1.4; }
.field span[aria-hidden="true"] { color: var(--accent); }
input[type="text"], input[type="tel"] { display: block; width: 100%; padding: 14px 15px; border: 1px solid var(--line); border-radius: 12px; outline: none; color: var(--ink); background: rgba(255,255,255,.7); transition: border-color .2s, box-shadow .2s; }
input[type="text"]::placeholder, input[type="tel"]::placeholder { color: #8da9ad; }
input[type="text"]:focus, input[type="tel"]:focus { border-color: var(--deep-sky); box-shadow: 0 0 0 4px rgba(43,156,175,.13); }
.field-hint { margin: 8px 0 0; color: #5d858b; font-size: 12px; line-height: 1.55; }
.choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.choice-grid.two-columns { grid-template-columns: repeat(2, 1fr); }
.choice { position: relative; display: flex; min-height: 47px; align-items: center; justify-content: center; padding: 8px 9px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-size: 14px; text-align: center; transition: .2s ease; }
.choice input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; opacity: 0; }
.choice:has(input:checked) { border-color: var(--deep-sky); color: #116c7c; background: #dff9fb; box-shadow: inset 0 0 0 1px var(--deep-sky); }
.choice:has(input:focus-visible) { outline: 3px solid rgba(43,156,175,.28); outline-offset: 2px; }
.upload-box { display: flex !important; min-height: 105px; align-items: center; justify-content: center; gap: 10px; padding: 17px; border: 1px dashed #5fb5c1; border-radius: 13px; color: #317d89; background: rgba(224,249,251,.55); cursor: pointer; text-align: center; }
.upload-box:hover { background: #e2f9fb; }
.upload-box input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.upload-icon { display: grid; width: 27px; height: 27px; place-items: center; border-radius: 50%; color: #fff; background: var(--deep-sky); font-size: 21px; line-height: 1; }
.form-message { min-height: 20px; margin: -6px 0 12px; color: #c74d39; font-size: 14px; }
.generate-button, .download-button, .edit-button { width: 100%; min-height: 52px; border: 0; border-radius: 999px; cursor: pointer; transition: transform .18s, box-shadow .18s; }
.generate-button, .download-button { color: #fff; background: linear-gradient(100deg, #e9604e, #f59b4e); box-shadow: 0 10px 22px rgba(205,89,62,.25); font-weight: 700; }
.generate-button:hover, .download-button:hover { transform: translateY(-2px); box-shadow: 0 13px 25px rgba(205,89,62,.3); }
.generate-button:focus-visible, .download-button:focus-visible, .edit-button:focus-visible { outline: 3px solid rgba(24,90,102,.4); outline-offset: 3px; }
.result { margin-top: 28px; padding: clamp(24px, 5vw, 38px); text-align: center; }
.result h2 { margin: 0 0 24px; font-size: clamp(24px, 6vw, 34px); }
.invitation-frame { overflow: hidden; border-radius: 12px; box-shadow: 0 12px 28px rgba(24,90,102,.22); background: #8eddea; }
#invitation-poster { display: block; width: 100%; height: auto; -webkit-touch-callout: default; -webkit-user-select: auto; user-select: auto; touch-action: auto; }
.result-actions { display: grid; grid-template-columns: 1.25fr 1fr; gap: 10px; margin-top: 19px; }
.edit-button { border: 1px solid rgba(24,90,102,.34); color: var(--ink); background: transparent; }
.edit-button:hover { background: rgba(116,214,226,.18); }
.result-note { margin: 16px 0 0; color: #5d858b; font-size: 12px; line-height: 1.6; }

@media (max-width: 600px) {
  body::before, body::after { display: none; }
  .page-shell { padding: calc(22px + env(safe-area-inset-top)) 14px calc(42px + env(safe-area-inset-bottom)); }
  .intro { padding: 6px 4px 20px; }
  h1 { font-size: clamp(30px, 9vw, 38px); }
  .intro p:last-child { margin-top: 10px; font-size: 14px; }
  .form-card, .result { border-radius: 19px; }
  .form-card { padding: 22px 18px 24px; }
  .field { margin-bottom: 22px; }
  .field > label, legend { margin-bottom: 9px; }
  input[type="text"], input[type="tel"] { min-height: 54px; padding: 14px 15px; font-size: 16px; }
  .choice-grid { gap: 8px; }
  .choice { min-height: 52px; padding: 7px 6px; font-size: 13px; line-height: 1.25; }
  .upload-box { min-height: 88px; padding: 14px; }
  .field-hint { margin-top: 7px; }
  .generate-button, .download-button, .edit-button { min-height: 56px; }
  .result { margin-top: 22px; padding: 22px 18px 24px; }
  .result h2 { margin-bottom: 18px; }
  .result-actions { grid-template-columns: 1fr; gap: 9px; margin-top: 16px; }
}

@media (max-width: 360px) {
  .choice { min-height: 50px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
