:root {
  font-family: "PingFang SC", "Microsoft YaHei UI", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #333;
  background: #fff9e6;
  font-synthesis: none;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: linear-gradient(180deg, #fff9e6 0%, #ffeaa7 100%);
}

button,
input {
  font: inherit;
}

.hidden {
  display: none !important;
}

.app,
.page {
  min-height: 100vh;
}

.page {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
}

.page-content {
  display: flex;
  width: 100%;
  max-width: 420px;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.hero-nailong {
  width: 120px;
  height: auto;
  animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
  50% { transform: translateY(-8px); }
}

.title {
  margin: 0;
  color: #333;
  font-size: clamp(2rem, 7vw, 2.5rem);
  font-weight: 800;
  text-align: center;
}

.subtitle {
  margin: 0;
  color: #666;
  text-align: center;
}

.login-form {
  display: flex;
  width: 100%;
  max-width: 320px;
  flex-direction: column;
  gap: 0.75rem;
}

.github-login-button {
  display: flex;
  width: 100%;
  max-width: 320px;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  border-radius: 24px;
  padding: 0.95rem 1.5rem;
  background: #24292f;
  box-shadow: 0 4px 12px rgba(36, 41, 47, 0.22);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
}

.github-login-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(36, 41, 47, 0.3);
}

.login-divider {
  display: flex;
  width: 100%;
  max-width: 320px;
  align-items: center;
  gap: 0.75rem;
  color: #8a8065;
  font-size: 0.8125rem;
}

.login-divider::before,
.login-divider::after {
  height: 1px;
  flex: 1;
  background: rgba(90, 74, 0, 0.18);
  content: "";
}

.text-input {
  width: 100%;
  padding: 0.875rem 1.25rem;
  border: 2px solid #ffd93d;
  border-radius: 16px;
  outline: none;
  background: #fff;
}

.text-input:focus {
  border-color: #f5a623;
  box-shadow: 0 0 0 3px rgba(255, 217, 61, 0.35);
}

.primary-button,
.upload-button,
.camera-button,
.secondary-button {
  border-radius: 24px;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}

.primary-button,
.upload-button {
  border: 0;
  padding: 1rem 2.5rem;
  background: #ffd93d;
  box-shadow: 0 4px 12px rgba(245, 166, 35, 0.35);
  color: #333;
  font-size: 1.125rem;
  font-weight: 600;
  text-align: center;
}

.image-source-buttons {
  display: grid;
  width: 100%;
  max-width: 320px;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.image-source-buttons .upload-button,
.image-source-buttons .camera-button {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1rem;
  font-size: 1rem;
}

.camera-button {
  border: 2px solid #ffd93d;
  background: rgba(255, 255, 255, 0.55);
  color: #5a4a00;
  font-weight: 600;
}

.camera-button:hover {
  transform: translateY(-2px);
  background: #fff;
}

.primary-button:hover,
.upload-button:hover {
  transform: translateY(-2px);
  background: #f5a623;
  box-shadow: 0 6px 16px rgba(245, 166, 35, 0.45);
}

.secondary-button {
  border: 2px solid #ffd93d;
  padding: 1rem 2.5rem;
  background: transparent;
  color: #666;
}

.secondary-button:hover {
  background: #ffd93d;
  color: #333;
}

.dev-notice {
  margin: 0;
  border: 1px dashed #ffd93d;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  background: #fff;
  color: #888;
  font-size: 0.8125rem;
  text-align: center;
}

.form-error {
  margin: 0;
  color: #a03030;
  font-size: 0.875rem;
  text-align: center;
}

.user-bar {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  left: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-email {
  overflow: hidden;
  color: #666;
  font-size: 0.875rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-button {
  border: 0;
  padding: 0.25rem;
  background: transparent;
  color: #666;
  cursor: pointer;
  text-decoration: underline;
}

.quota-badge {
  margin: 0;
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.quota-ok {
  background: rgba(255, 217, 61, 0.35);
  color: #5a4a00;
}

.quota-used {
  background: rgba(214, 69, 69, 0.12);
  color: #a03030;
}

.preview-container {
  width: 100%;
  max-width: 280px;
  overflow: hidden;
  border: 3px solid #ffd93d;
  border-radius: 24px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.preview-image {
  display: block;
  width: 100%;
  max-height: 380px;
  object-fit: contain;
}

.result-container {
  position: relative;
  width: 100%;
  max-width: 320px;
  overflow: hidden;
  border-radius: 24px;
  aspect-ratio: 1;
  background: #fff9e6;
  box-shadow: 0 8px 24px rgba(245, 166, 35, 0.3);
}

.result-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 1;
  mix-blend-mode: normal;
}

.button-group {
  display: flex;
  width: 100%;
  max-width: 280px;
  flex-direction: column;
  gap: 0.75rem;
}

.loading-overlay,
.surprise-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.72);
}

.camera-panel {
  width: min(94vw, 520px);
  border-radius: 24px;
  padding: 1rem;
  background: #fff9e6;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

.camera-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.camera-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.camera-close-button {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  color: #333;
  cursor: pointer;
  font-size: 1.7rem;
  line-height: 1;
}

.camera-video {
  display: block;
  width: 100%;
  max-height: 65vh;
  border-radius: 18px;
  background: #171717;
  object-fit: contain;
}

.camera-message {
  margin: 0.75rem 0 0;
  color: #666;
  font-size: 0.875rem;
  text-align: center;
}

.camera-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1rem;
}

.camera-actions button {
  padding: 0.85rem 1rem;
}

@media (max-width: 420px) {
  .image-source-buttons,
  .camera-actions {
    grid-template-columns: 1fr;
  }
}

.loading-overlay {
  background: rgba(255, 249, 230, 0.94);
}

.loading-content,
.prank-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.loading-nailong {
  width: 100px;
  animation: spin-bounce 1.2s ease-in-out infinite;
}

@keyframes spin-bounce {
  25% { transform: rotate(-10deg) scale(1.05); }
  75% { transform: rotate(10deg) scale(1.05); }
}

.loading-text {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.surprise-overlay {
  z-index: 2000;
  background: rgba(0, 0, 0, 0.55);
  cursor: pointer;
}

.surprise-card {
  position: relative;
  width: min(90%, 340px);
  border-radius: 24px;
  padding: 2rem 2.5rem;
  background: linear-gradient(160deg, #fff9e6, #ffd93d);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  text-align: center;
}

.surprise-tag {
  position: absolute;
  top: 12px;
  right: 12px;
  border-radius: 4px;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.7);
  color: #888;
  font-size: 0.75rem;
}

.surprise-image {
  width: 100px;
}

.surprise-title {
  margin: 0 0 0.5rem;
  font-size: 1.375rem;
}

.surprise-desc {
  margin: 0 0 1rem;
  color: #555;
}

.surprise-hint {
  margin: 0;
  color: #888;
  font-size: 0.8125rem;
}

.prank-gif {
  width: min(320px, 85vw);
  border-radius: 24px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.prank-text {
  margin: 0;
  color: #ffd93d;
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
