@font-face {
  font-family: Tinos;
  src: url("/fonts/Tinos-Regular.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Good Vibes Pro";
  src: url("/fonts/Good%20Vibes%20Pro.ttf") format("truetype");
  font-display: swap;
}

:root {
  --bg: #1a3c32;
  --ink: #4e3b2e;
  --muted: #8d705c;
  --paper: #f4e7d2;
  --paper-deep: #e7d3b4;
  --line: #e3d3bc;
  --burgundy: #7d2230;
  --cream: #f6ead8;
  --gold: #e7c98a;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { overflow-x: hidden; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: Tinos, "Times New Roman", serif;
  color: var(--cream);
  background: #163228;
  overflow-x: hidden;
}

button, input, select { font: inherit; color: inherit; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hp {
  position: absolute;
  left: -10000px;
  opacity: 0;
}

/* ---------- background and decorations ---------- */

.bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: #163228 url("/image/bg.jpg") center / cover no-repeat;
}

.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 42%, rgba(0, 0, 0, 0) 42%, rgba(3, 14, 10, 0.28) 100%);
}

.scene {
  position: relative;
  z-index: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  isolation: isolate;
}

.decor {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}

.deco,
.star {
  position: absolute;
  height: auto;
  pointer-events: none;
  user-select: none;
}

.top-red {
  z-index: 1;
  width: 125vw;
  max-width: 1600px;
  left: -9vw;
  top: -60vw;
  transform: rotate(20.5deg);
  transform-origin: 0 0;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.22));
}

.bottom-red {
  z-index: 1;
  width: 112vw;
  max-width: 1600px;
  height: clamp(118px, 14vh, 180px);
  left: -6vw;
  bottom: 0;
  object-fit: fill;
  filter: drop-shadow(0 -10px 16px rgba(0, 0, 0, 0.2));
}

.gift-top {
  z-index: 2;
  width: clamp(320px, 55vw, 480px);
  left: clamp(-260px, -38vw, -180px);
  top: clamp(-230px, -34vw, -160px);
  filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.28));
}

.gift-bottom {
  z-index: 2;
  width: clamp(180px, 27vw, 300px);
  right: clamp(-36px, -2.5vw, -10px);
  bottom: clamp(0px, 1vw, 14px);
  filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.28));
}

.ribbon {
  z-index: 1;
  width: clamp(190px, 27vw, 360px);
  right: -5vw;
  top: 36%;
  filter: drop-shadow(0 12px 16px rgba(0, 0, 0, 0.26));
}

.star {
  z-index: 2;
  filter: drop-shadow(0 0 6px rgba(231, 201, 138, 0.32));
}

.s1  { width: clamp(28px, 4vw, 46px); top: 7%;  left: 50%; }
.s2  { width: clamp(13px, 1.8vw, 21px); top: 14%; left: 23%; opacity: 0.9; }
.s3  { width: clamp(18px, 2.4vw, 28px); top: 12%; right: 11%; }
.s4  { width: clamp(10px, 1.4vw, 17px); top: 22%; left: 7%; opacity: 0.9; }
.s5  { width: clamp(19px, 2.8vw, 32px); top: 38%; left: 4%; }
.s6  { width: clamp(12px, 1.7vw, 19px); top: 50%; left: 8%; opacity: 0.85; }
.s7  { width: clamp(18px, 2.5vw, 29px); top: 39%; right: 5%; }
.s8  { width: clamp(11px, 1.5vw, 17px); top: 59%; right: 10%; opacity: 0.85; }
.s9  { width: clamp(15px, 2vw, 24px); top: 74%; left: 6%; }
.s10 { width: clamp(9px, 1.3vw, 15px); top: 10%; right: 28%; opacity: 0.85; }

@media (prefers-reduced-motion: no-preference) {
  .star { animation: twinkle 4.2s ease-in-out infinite; }
  .s2, .s6, .s10 { animation-delay: -1.5s; }
  .s3, .s7 { animation-delay: -2.4s; }
  .s5, .s9 { animation-delay: -3.2s; }
}

@keyframes twinkle {
  50% { opacity: 0.42; }
}

/* ---------- hero ---------- */

.sheet {
  position: relative;
  z-index: 3;
  width: min(700px, 100%);
  margin: 0 auto;
  padding: clamp(108px, 17vw, 160px) 10px clamp(84px, 11vw, 120px);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero {
  width: 100%;
  text-align: center;
}

.reg-strip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 1.8vw, 15px) clamp(20px, 3.2vw, 30px);
  background: url("/image/reg-strip.png") center / 100% 100% no-repeat;
  filter: drop-shadow(0 7px 10px rgba(0, 0, 0, 0.24));
}

.reg-strip span {
  color: #5a3c2a;
  font-family: Tinos, serif;
  font-size: clamp(28px, 6vw, 52px);
  line-height: 1;
  letter-spacing: 0.01em;
  transform: translateY(-2px);
  text-shadow: 0 1px 0 rgba(255, 242, 220, 0.25);
}

h1 {
  margin: 0;
  font-weight: 400;
}

.line-youth,
.line-evening {
  display: block;
  font-family: Tinos, serif;
  font-weight: 400;
  color: #f4e7d2;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.3);
}

.line-youth {
  font-size: clamp(38px, 8.4vw, 95px);
  line-height: 0.94;
  letter-spacing: 0.005em;
}

.line-script {
  display: block;
  margin: -1px 0 -7px;
  font-family: "Good Vibes Pro", cursive;
  font-size: clamp(50px, 13vw, 150px);
  font-weight: 400;
  line-height: 0.8;
  color: #f3e0c2;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
}

.line-evening {
  font-size: clamp(44px, 9.6vw, 110px);
  line-height: 0.88;
  margin-top: -4px;
}

.when-art {
  display: block;
  width: min(430px, 88%);
  height: auto;
  margin: 12px auto 30px;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.18));
}

/* ---------- form card ---------- */

.card {
  position: relative;
  z-index: 2;
  width: min(500px, 90%);
  padding: clamp(30px, 5vw, 48px) clamp(36px, 7.8vw, 56px) clamp(28px, 4.6vw, 44px);
  background: url("/image/paper.png") center / 100% 100% no-repeat;
  color: var(--ink);
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.32));
}

.field { margin-bottom: 9px; }

.field label {
  display: flex;
  align-items: center;
  gap: 11px;
  height: clamp(48px, 5.4vw, 54px);
  padding: 0 clamp(11px, 1.8vw, 15px);
  background: linear-gradient(180deg, rgba(255, 248, 236, 0.48), rgba(239, 219, 191, 0.38));
  border: 1px solid rgba(255, 246, 230, 0.7);
  border-radius: 11px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    inset 0 -1px 2px rgba(120, 85, 50, 0.06);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.field label:focus-within {
  border-color: rgba(184, 138, 90, 0.9);
  background: linear-gradient(180deg, rgba(255, 250, 241, 0.7), rgba(242, 224, 198, 0.56));
}

.field-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  object-fit: contain;
}

.field input {
  width: 100%;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  color-scheme: light;
  font-size: clamp(15px, 2vw, 17px);
}

.field input::placeholder { color: #8f7159; opacity: 1; }

.field.invalid label {
  border-color: var(--burgundy);
  background: #fbf3ea;
}

.field-error,
.form-error {
  min-height: 0;
  margin: 4px 6px 0;
  color: #8a2432;
  font-size: 13px;
  line-height: 1.3;
}

.field-error:empty,
.form-error[hidden] { display: none; }

.submit {
  width: 100%;
  min-height: clamp(50px, 5.6vw, 58px);
  margin-top: 16px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #932c3b 0%, #6d1221 100%);
  color: #f8ead7;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-family: Tinos, serif;
  font-size: clamp(20px, 2.9vw, 25px);
  line-height: 1;
  text-decoration: none;
  box-shadow:
    0 10px 18px rgba(70, 12, 20, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  transition: filter 0.15s ease, transform 0.15s ease;
}

.submit-icon { width: 18px; height: 18px; flex: 0 0 auto; object-fit: contain; }

.submit:hover { filter: brightness(1.07); }
.submit:active { transform: translateY(1px); }
.submit:disabled { cursor: progress; opacity: 0.72; }

/* ---------- payment step ---------- */

.pay-step {
  padding: 0 2px 2px;
  text-align: center;
}

.pay-title {
  margin: 0 0 4px;
  font-family: Tinos, serif;
  font-size: clamp(34px, 5vw, 46px);
  font-weight: 400;
  line-height: 1;
  color: #5b3d2b;
}

.pay-subtitle {
  max-width: 360px;
  margin: 0 auto 18px;
  color: #6d5646;
  font-size: clamp(16px, 2.4vw, 19px);
  line-height: 1.35;
}

.qr-frame {
  width: min(232px, 64%);
  aspect-ratio: 1;
  margin: 0 auto 14px;
  padding: 10px;
  display: grid;
  place-items: center;
  background: #fffaf2;
  border-radius: 14px;
  box-shadow: 0 8px 18px rgba(90, 60, 30, 0.18);
}

.qr-frame > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.qr-missing {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1.5px dashed #b89a7e;
  border-radius: 8px;
  background: #fbf3e6;
  color: #8d705c;
  font-size: 18px;
  line-height: 1.15;
}

.qr-missing[hidden],
.pay-step[hidden],
#reg-form[hidden] { display: none; }

.qr-missing img {
  width: 42px;
  height: auto;
  opacity: 0.8;
}

.pay-hint {
  margin: 0 0 15px;
  color: #5b3d2b;
  font-size: clamp(18px, 2.8vw, 22px);
  line-height: 1.3;
}

/* ---------- success page ---------- */

.success-sheet {
  position: relative;
  z-index: 3;
  width: min(580px, 100%);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: clamp(100px, 14vw, 165px) 18px clamp(100px, 12vw, 145px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.success-card {
  width: min(520px, 100%);
  padding: clamp(52px, 7vw, 78px) clamp(26px, 5vw, 54px) clamp(46px, 6vw, 64px);
  background: url("/image/paper.png") center / 100% 100% no-repeat;
  color: var(--ink);
  text-align: center;
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.34));
}

.success-star {
  display: block;
  width: clamp(42px, 6vw, 58px);
  height: auto;
  margin: 0 auto 10px;
  filter: drop-shadow(0 2px 6px rgba(90, 50, 10, 0.2));
}

.success-card h1 {
  margin: 0 0 10px;
  font-family: Tinos, serif;
  font-size: clamp(44px, 7vw, 64px);
  font-weight: 400;
  line-height: 1;
  color: #5b3d2b;
}

.success-lead {
  margin: 0 0 14px;
  color: #4e3b2e;
  font-size: clamp(22px, 3.4vw, 28px);
  line-height: 1.28;
}

.success-lead strong {
  font-weight: 400;
  color: #7d2230;
  white-space: nowrap;
}

.success-text {
  margin: 0 0 24px;
  color: #6d5646;
  font-size: clamp(18px, 2.8vw, 22px);
  line-height: 1.4;
}

.channel-button {
  width: auto;
  min-width: min(320px, 100%);
  padding: 0 28px;
  font-size: clamp(18px, 2.8vw, 22px);
  white-space: nowrap;
}

.back-link {
  display: inline-block;
  margin-top: 18px;
  color: #8a2432;
  font-size: 17px;
  text-underline-offset: 3px;
}

/* ---------- responsive ---------- */

@media (max-width: 720px) {
  .top-red { width: 150vw; left: -22vw; top: -62vw; }
  .bottom-red { width: 126vw; left: -13vw; }
  .ribbon { display: none; }
  .s5, .s7, .s9 { display: none; }
  .sheet { padding-top: 124px; }
  .success-sheet { padding-top: 104px; }
}

@media (max-width: 420px) {
  .card { width: 90%; padding-left: 34px; padding-right: 34px; }
  .gift-top { width: 320px; left: -180px; top: -160px; }
  .gift-bottom { width: 185px; right: -22px; }
  .line-script { font-size: clamp(49px, 13.6vw, 60px); }
  .when-art { width: 96%; }
  .success-sheet { padding-left: 12px; padding-right: 12px; }
}

@media (min-width: 900px) {
  .sheet { padding-top: 150px; }
  .when-art { width: 440px; }
  .ribbon { width: 330px; right: -3vw; top: 37%; }
}

/* ---------- admin ---------- */

body.admin-page {
  background: #163228 url("/image/bg.jpg") center / cover fixed no-repeat;
}

.admin-page .sheet {
  width: min(1100px, 100%);
  align-items: stretch;
}

.admin-card {
  width: min(440px, 100%);
  margin: 10vh auto 0;
  padding: 28px 22px;
  background: linear-gradient(180deg, #f7edd9, #e8d4b6);
  color: var(--ink);
  border-radius: 18px;
}

.admin-card h1,
.admin-head h1 {
  margin: 0 0 8px;
  font-family: Tinos, serif;
  font-weight: 400;
}

.admin-card p,
.muted { color: #6d5646; }

.status-guide {
  margin: 12px 0 14px;
  padding: 12px 14px;
  border: 1px solid rgba(105, 17, 11, 0.2);
  border-left: 4px solid #69110B;
  border-radius: 10px;
  background: #fffaf2;
  color: #4e3b2e;
  font-size: 16px;
  line-height: 1.45;
}

.status-guide p {
  margin: 0;
}

.status-guide p + p {
  margin-top: 6px;
}

.status-guide strong {
  color: #69110B;
  font-weight: 700;
}

.admin-refresh-error {
  margin: 0 0 8px;
  color: #8a2432;
  font-size: 14px;
}

.admin-refresh-error[hidden] {
  display: none;
}

.payment-screenshot-cell {
  min-width: 92px;
  vertical-align: middle;
}

.payment-screenshot-link {
  display: block;
  width: 64px;
  height: 48px;
  overflow: hidden;
  border: 1px solid #e4d3ba;
  border-radius: 6px;
  background: #fffaf2;
}

.payment-screenshot-link img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.payment-screenshot-empty {
  color: #8d705c;
  font-size: 13px;
  white-space: nowrap;
}

.payment-screenshot-dialog {
  position: fixed;
  max-width: 94vw;
  max-height: 92dvh;
  padding: 42px 12px 12px;
  overflow: auto;
  border: 0;
  border-radius: 12px;
  background: #f4e7d2;
  color: var(--ink);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.4);
}

.payment-screenshot-dialog::backdrop {
  background: rgba(0, 0, 0, 0.76);
}

.payment-screenshot-dialog > img {
  display: block;
  width: auto;
  height: auto;
  max-width: 90vw;
  max-height: 82dvh;
  object-fit: contain;
}

.payment-screenshot-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 30px;
  height: 30px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(112, 77, 48, 0.35);
  border-radius: 50%;
  background: #fffaf2;
  color: #4e3b2e;
  font-size: 23px;
  line-height: 1;
  cursor: pointer;
}

.admin-card input {
  width: 100%;
  height: 52px;
  margin: 12px 0;
  padding: 0 14px;
  border: 1px solid #e4d3ba;
  border-radius: 12px;
  background: #fffaf2;
  color: var(--ink);
  color-scheme: light;
  font-size: 16px;
}

.admin-error { min-height: 1.2em; color: #8a2432; }

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
}

.stat {
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255, 250, 242, 0.14);
}

.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

.ghost {
  height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(246, 234, 216, 0.4);
  background: transparent;
  color: var(--cream);
  cursor: pointer;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 16px;
  background: rgba(255, 250, 242, 0.96);
  color: var(--ink);
}

table { width: 100%; border-collapse: collapse; min-width: 700px; }

th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #eadcc8;
  font-size: 14px;
  vertical-align: top;
}

th {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8d705c;
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f0e2cc;
  white-space: nowrap;
}

.badge.paid { background: #e5f2e6; color: #246648; }
.badge.failed, .badge.mismatch, .badge.refunded { background: #f8e4e6; color: #8a2432; }

.empty { padding: 28px 16px; text-align: center; }
