* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Noto Sans CJK SC", "Noto Sans SC", "Segoe UI", Arial, sans-serif;
  background: radial-gradient(circle at top, #fff7d6 0%, #fffdf4 46%, #f4e7ba 100%);
  color: #2c2418;
  min-height: 100vh;
}

.wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 18px;
}

.wide {
  max-width: 1240px;
  margin: 0 auto;
  padding: 18px;
}

.card {
  background: rgba(255, 253, 243, 0.98);
  border: 1px solid #e6d49a;
  border-radius: 22px;
  padding: clamp(18px, 4vw, 30px);
  box-shadow: 0 12px 34px rgba(90, 68, 20, .12);
}

.hero {
  text-align: center;
  margin-top: 24px;
}

.brandmark {
  font-size: 52px;
  line-height: 1;
  margin-bottom: 10px;
}

h1 {
  margin-top: 0;
  color: #4d3b13;
  font-size: clamp(25px, 7vw, 42px);
}

h2 {
  color: #5f4c1c;
  font-size: clamp(18px, 4.8vw, 26px);
}

h3 {
  margin-top: 24px;
}

p {
  line-height: 1.62;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 1px solid #8d7428;
  background: #fffbe8;
  color: #3b2f10;
  border-radius: 999px;
  padding: 12px 18px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 16px;
}

.btn.primary {
  background: #f5c934;
  border-color: #c79a13;
}

.btn.full {
  width: 100%;
}

label {
  display: block;
  font-weight: 700;
  margin-top: 16px;
}

input,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px;
  border: 1px solid #d2c17f;
  border-radius: 12px;
  background: #fff;
  font: inherit;
  font-size: 16px;
}

textarea {
  min-height: 96px;
}

.signature-wrap {
  width: 100%;
  background: #fff;
  border: 2px dashed #c6ae5d;
  border-radius: 14px;
  overflow: hidden;
  touch-action: none;
}

canvas {
  display: block;
  width: 100%;
  height: 230px;
  background: #fff;
  touch-action: none;
}

.check {
  font-weight: 500;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  line-height: 1.45;
}

.check input {
  width: auto;
  min-height: auto;
  margin-top: 4px;
  transform: scale(1.25);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.admin-table td,
.admin-table th {
  border: 1px solid #ddd;
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.small {
  font-size: 12px;
  color: #666;
}

.error {
  color: #a40000;
  font-weight: 700;
}

@media (max-width: 620px) {
  .wrap,
  .wide {
    padding: 12px;
  }

  .card {
    border-radius: 18px;
    padding: 18px;
  }

  .actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }
}

/* Loading overlay while PDF is generated */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(38, 31, 12, 0.68);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.loading-overlay.is-visible {
  display: flex;
}

.loading-card {
  width: min(92vw, 430px);
  background: #fffdf3;
  border: 1px solid #e6d49a;
  border-radius: 24px;
  padding: 26px 22px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .28);
}

.loading-card h2 {
  margin: 14px 0 4px;
  font-size: 23px;
}

.loading-card h3 {
  margin: 0 0 14px;
  font-size: 19px;
  color: #5f4c1c;
}

.loading-card p {
  margin: 10px 0;
  line-height: 1.5;
}

.loading-small {
  font-size: 13px;
  color: #78652a;
}

.loading-spinner {
  width: 58px;
  height: 58px;
  margin: 0 auto;
  border-radius: 50%;
  border: 6px solid #f3e6ae;
  border-top-color: #d3a40e;
  animation: lemonlings-spin 0.85s linear infinite;
}

@keyframes lemonlings-spin {
  to {
    transform: rotate(360deg);
  }
}

body.is-loading {
  overflow: hidden;
}

button:disabled {
  opacity: .7;
  cursor: wait;
}

@media (prefers-reduced-motion: reduce) {
  .loading-spinner {
    animation-duration: 1.8s;
  }
}

/* Camera upload cards */
.upload-section {
  margin-top: 22px;
}

.upload-section .hint,
.hint {
  font-size: 14px;
  color: #735f20;
  line-height: 1.45;
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.upload-card {
  background: #fffbe8;
  border: 1px solid #e2cf87;
  border-radius: 18px;
  padding: 14px;
}

.upload-card.required-card {
  border-color: #c79a13;
  background: #fff6c9;
}

.upload-title {
  font-weight: 800;
  color: #4d3b13;
  margin-bottom: 6px;
  line-height: 1.3;
}

.file-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  margin-top: 10px;
  border-radius: 999px;
  background: #f5c934;
  border: 1px solid #c79a13;
  color: #3b2f10;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
  padding: 10px 12px;
}

.file-btn.secondary {
  background: #fffdf3;
  border-color: #8d7428;
}

.file-btn input {
  display: none;
}

@media (max-width: 820px) {
  .upload-grid {
    grid-template-columns: 1fr;
  }
}


.lemon-world-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 14px 0 18px;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(255, 231, 122, 0.28);
  border: 1px solid rgba(180, 135, 20, 0.24);
  color: #3c2b00;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
  box-shadow: 0 4px 14px rgba(0,0,0,0.06);
}

.lemon-world-back:hover {
  background: rgba(255, 231, 122, 0.42);
  text-decoration: none;
}

@media (max-width: 640px) {
  .lemon-world-back {
    margin: 10px 0 14px;
    padding: 8px 12px;
    font-size: 13px;
  }
}


@keyframes selfieRequiredShake {
  0% { transform: translateX(0); }
  15% { transform: translateX(-8px); }
  30% { transform: translateX(8px); }
  45% { transform: translateX(-6px); }
  60% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
  100% { transform: translateX(0); }
}

.selfie-required-shake {
  animation: selfieRequiredShake 0.42s ease-in-out;
}


.selfie-required-error {
  display: none;
  margin: 10px 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 80, 80, 0.10);
  border: 1px solid rgba(180, 30, 30, 0.28);
  color: #7a1111;
  font-weight: 700;
  line-height: 1.35;
}

.selfie-required-error.is-visible {
  display: block;
}

.selfie-required-highlight {
  outline: 2px solid rgba(180, 30, 30, 0.55);
  outline-offset: 3px;
  border-radius: 12px;
}

@keyframes selfieRequiredShake {
  0% { transform: translateX(0); }
  15% { transform: translateX(-8px); }
  30% { transform: translateX(8px); }
  45% { transform: translateX(-6px); }
  60% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
  100% { transform: translateX(0); }
}

.selfie-required-shake {
  animation: selfieRequiredShake 0.42s ease-in-out;
}

