* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'PingFang SC', 'Microsoft YaHei', 'Comic Sans MS', sans-serif;
  background: linear-gradient(135deg, #fde2ff 0%, #e8d9ff 45%, #ffe3ec 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  position: relative;
  overflow-x: hidden;
  color: #5b4a6a;
}

.bg-deco {
  position: fixed;
  font-size: 42px;
  opacity: 0.5;
  pointer-events: none;
  animation: float 6s ease-in-out infinite;
}
.bg-deco-1 { top: 8%; left: 6%; animation-delay: 0s; }
.bg-deco-2 { top: 18%; right: 8%; animation-delay: 1s; font-size: 30px; }
.bg-deco-3 { bottom: 10%; left: 10%; animation-delay: 2s; font-size: 50px; }
.bg-deco-4 { bottom: 16%; right: 10%; animation-delay: 1.5s; font-size: 34px; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}

.card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 28px;
  padding: 32px 28px;
  box-shadow: 0 16px 40px rgba(159, 110, 200, 0.25);
  border: 3px solid #f3c9ec;
}

.title {
  margin: 0 0 6px;
  text-align: center;
  font-size: 26px;
  color: #9b6bc7;
  font-weight: 800;
}

.subtitle {
  margin: 0 0 24px;
  text-align: center;
  font-size: 13px;
  color: #a48bb8;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: #8a6aa8;
  display: flex;
  align-items: center;
  gap: 5px;
}

.help-btn {
  width: 16px;
  height: 16px;
  border: 1.5px solid #c98fe0;
  border-radius: 50%;
  background: none;
  color: #c98fe0;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.help-btn:hover {
  background: #c98fe0;
  color: #fff;
}

.help-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.help-list li {
  font-size: 13px;
  color: #5b4a6a;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.help-cat {
  font-weight: 700;
  color: #9b6bc7;
  white-space: nowrap;
  flex-shrink: 0;
}

.required {
  color: #ff8fb3;
}

input[type='text'] {
  border: 2px solid #ecd6f5;
  border-radius: 14px;
  padding: 11px 14px;
  font-size: 14px;
  outline: none;
  background: #fffaff;
  transition: border-color 0.15s ease;
  color: #5b4a6a;
}

input[type='text']:focus {
  border-color: #c98fe0;
}

.btn-primary {
  margin-top: 6px;
  border: none;
  border-radius: 16px;
  padding: 13px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #c98fe0, #f3a6c8);
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(201, 143, 224, 0.45);
  text-align: center;
  text-decoration: none;
  display: inline-block;
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
}

.error-msg {
  margin: 14px 0 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: #ffe3e3;
  color: #c0455a;
  font-size: 13px;
  text-align: left;
  overflow-wrap: break-word;
  word-break: break-all;
  white-space: pre-line;
}

.result {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.result-img {
  width: 100%;
  max-width: 280px;
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(159, 110, 200, 0.3);
  cursor: zoom-in;
}

.result-info {
  width: 100%;
  background: #fbf3ff;
  border-radius: 16px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  flex-wrap: wrap;
}

.info-label {
  font-weight: 700;
  color: #9b6bc7;
  white-space: nowrap;
}

#shortUrlText {
  word-break: break-all;
  flex: 1;
  color: #9b6bc7;
  text-decoration: underline;
}

#shortUrlText:hover {
  color: #7a4a99;
}

.btn-mini {
  border: none;
  border-radius: 10px;
  padding: 4px 10px;
  font-size: 12px;
  background: #e8cdf3;
  color: #7a4a99;
  cursor: pointer;
}

.confirm-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 998;
  animation: fadeIn 0.15s ease;
}

.confirm-dialog {
  background: rgba(255, 255, 255, 0.97);
  border-radius: 20px;
  padding: 24px 20px;
  max-width: 320px;
  width: 90%;
  box-shadow: 0 16px 40px rgba(159, 110, 200, 0.3);
  border: 2px solid #f3c9ec;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.confirm-title {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 700;
  color: #9b6bc7;
}

.confirm-text {
  margin: 0;
  font-size: 14px;
  color: #5b4a6a;
  line-height: 1.6;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.confirm-ok {
  margin-top: 0;
  padding: 8px 20px;
  font-size: 14px;
}

.short-url-hint {
  margin: 2px 0 0;
  font-size: 11px;
  color: #b89cc8;
  line-height: 1.4;
}

.btn-download {
  width: 100%;
}

.image-preview-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  cursor: zoom-out;
  animation: fadeIn 0.15s ease;
  touch-action: none;
  overflow: hidden;
}

.image-preview-img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  cursor: grab;
  transform-origin: center center;
  transition: transform 0.08s ease-out;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
}

.image-preview-img:active {
  cursor: grabbing;
}

.image-preview-close {
  position: fixed;
  top: 20px;
  right: 28px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.image-preview-close:hover {
  background: rgba(255, 255, 255, 0.35);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
