/* === Reset & Base === */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

.hidden { display: none !important; }

/* === Activation Gate === */
.gate-overlay {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}

.gate-card {
  background: #fff;
  border-radius: 20px;
  padding: 48px 40px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  max-width: 420px;
  width: 90%;
}

.gate-card h1 {
  font-size: 28px;
  margin-bottom: 12px;
  color: #333;
}

.gate-card p {
  color: #666;
  margin-bottom: 24px;
}

.gate-card input {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  font-size: 20px;
  text-align: center;
  letter-spacing: 3px;
  font-family: monospace;
  margin-bottom: 16px;
  transition: border-color 0.2s;
}

.gate-card input:focus {
  outline: none;
  border-color: #667eea;
}

#activate-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

#activate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.error-text {
  color: #e74c3c !important;
  font-size: 14px;
  min-height: 20px;
}

.gate-hint {
  font-size: 13px;
  color: #999 !important;
  margin-top: 8px;
}

.gate-hint a { color: #667eea; text-decoration: none; }

/* === Main App === */
#app {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px;
}

header {
  text-align: center;
  color: #fff;
  margin-bottom: 32px;
}

header h1 { font-size: 32px; margin-bottom: 8px; }
.subtitle { opacity: 0.85; font-size: 16px; }

.badge {
  display: inline-block;
  background: rgba(255,255,255,0.2);
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 13px;
  margin-top: 8px;
}

main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  background: #fff;
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

@media (max-width: 700px) {
  main { grid-template-columns: 1fr; }
}

/* === Input Section === */
.input-section label {
  display: block;
  font-weight: 600;
  margin: 16px 0 8px;
  font-size: 14px;
  color: #555;
}

.input-section label:first-child { margin-top: 0; }

#qr-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 15px;
  transition: border-color 0.2s;
}

#qr-input:focus {
  outline: none;
  border-color: #667eea;
}

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

.style-card {
  border: 2px solid #e8e8e8;
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 13px;
}

.style-card:hover {
  border-color: #667eea;
  background: #f8f7ff;
}

.style-card.active {
  border-color: #667eea;
  background: linear-gradient(135deg, #f0edff, #e8e4ff);
  box-shadow: 0 2px 10px rgba(102, 126, 234, 0.2);
}

.style-card .style-icon {
  font-size: 28px;
  display: block;
  margin-bottom: 4px;
}

.style-card .style-name {
  font-weight: 600;
  color: #444;
}

/* Color row */
.color-row {
  display: flex;
  gap: 16px;
}

.color-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #666;
}

.color-pick input[type="color"] {
  width: 36px;
  height: 36px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  padding: 2px;
}

#logo-upload {
  width: 100%;
  font-size: 14px;
  color: #666;
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 24px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* === Preview Section === */
.preview-section h2 {
  font-size: 18px;
  color: #555;
  margin-bottom: 12px;
}

.preview-area {
  background: #f9f9f9;
  border: 2px dashed #ddd;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  padding: 24px;
  position: relative;
}

.preview-area canvas {
  max-width: 100%;
  border-radius: 12px;
}

.preview-hint {
  color: #bbb;
  font-size: 14px;
  margin-top: 12px;
}

.preview-area.has-qr .preview-hint { display: none; }
.preview-area.has-qr { border-style: solid; border-color: #667eea; }

.download-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.btn-download {
  flex: 1;
  padding: 10px;
  background: #f0f0f0;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  color: #555;
}

.btn-download:hover {
  background: #667eea;
  color: #fff;
  border-color: #667eea;
}

/* === Footer === */
footer {
  text-align: center;
  color: rgba(255,255,255,0.6);
  margin-top: 32px;
  font-size: 13px;
}

footer a { color: rgba(255,255,255,0.8); text-decoration: none; }
