:root {
  --bg: #f6f4f0;
  --card: #ffffff;
  --primary: #ff6b6b;
  --primary-dark: #ee5253;
  --text: #2d3436;
  --text-sub: #8395a7;
  --radius: 16px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
    "Microsoft YaHei", sans-serif;
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

.hidden {
  display: none !important;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 12px;
}

.app-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-logo {
  font-size: 36px;
  line-height: 1;
}

.app-title h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.app-title p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-sub);
}

.quota-badge {
  background: #fff;
  border: 1px solid #ffe3e3;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.app-main {
  padding: 0 20px 24px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.upload-zone {
  border: 2px dashed #dcdde1;
  border-radius: 12px;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  background: #fafafa;
}

.upload-zone.active {
  border-color: var(--primary);
  background: #fff5f5;
}

.upload-placeholder {
  text-align: center;
  padding: 24px;
}

.upload-icon {
  font-size: 44px;
}

.upload-main {
  font-size: 16px;
  font-weight: 600;
  margin: 8px 0 4px;
}

.upload-sub {
  font-size: 12px;
  color: var(--text-sub);
  margin: 0;
}

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

.section-title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
}

.style-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.style-item {
  border: 2px solid #ecf0f1;
  border-radius: 12px;
  padding: 14px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  background: #fff;
}

.style-item .style-emoji {
  font-size: 28px;
  display: block;
  margin-bottom: 6px;
}

.style-item .style-name {
  font-size: 14px;
  white-space: nowrap;
  color: var(--text);
}

.style-item.selected {
  border-color: var(--primary);
  background: #fff5f5;
}

.primary-btn {
  width: 100%;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), #ff9f43);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  padding: 15px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(255, 107, 107, 0.35);
}

.primary-btn:disabled {
  opacity: 0.45;
  box-shadow: none;
  cursor: not-allowed;
}

.primary-btn.small {
  width: auto;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 12px;
}

.ghost-btn {
  border: 1px solid #dcdde1;
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  font-size: 14px;
  padding: 10px 16px;
  cursor: pointer;
}

.ghost-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.privacy-note {
  text-align: center;
  font-size: 11px;
  color: var(--text-sub);
  margin: 10px 0 18px;
}

.result-wrap {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
}

.result-img {
  width: 100%;
  display: block;
  border-radius: 12px;
}

.result-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  justify-content: space-between;
}

.unlock-inner {
  text-align: center;
  padding: 8px 0;
}

.unlock-icon {
  font-size: 44px;
}

.unlock-title {
  font-size: 17px;
  font-weight: 600;
  margin: 10px 0 4px;
}

.unlock-desc {
  font-size: 13px;
  color: var(--text-sub);
  margin: 0 0 16px;
}

.text-btn {
  border: none;
  background: none;
  color: var(--text-sub);
  font-size: 13px;
  padding: 10px;
  cursor: pointer;
  display: block;
  width: 100%;
  margin-top: 6px;
}

.text-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.app-footer {
  text-align: center;
  font-size: 11px;
  color: #b2bec3;
  padding: 0 20px 24px;
}

.loading-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99;
}

.loading-box {
  background: #fff;
  border-radius: 16px;
  padding: 28px 36px;
  text-align: center;
}

.loading-box p {
  margin: 12px 0 0;
  font-size: 15px;
  font-weight: 600;
}

.loading-box .loading-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-sub);
  font-weight: 400;
}

.spinner {
  width: 42px;
  height: 42px;
  margin: 0 auto;
  border: 4px solid #ffe3e3;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.toast {
  position: fixed;
  left: 50%;
  bottom: 80px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 999px;
  z-index: 120;
  max-width: 80%;
  text-align: center;
  white-space: nowrap;
}
