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

:root {
  --green:  #2d6a4f;
  --light:  #d8f3dc;
  --accent: #52b788;
  --bg:     #f8fdf9;
  --card:   #ffffff;
  --text:   #1b1b1b;
  --muted:  #6b7c6e;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

header {
  background: linear-gradient(135deg, var(--green) 0%, #1b4332 100%);
  color: #fff;
  padding: 2rem 1.5rem 2.5rem;
  text-align: center;
}
header h1 { font-size: 2rem; letter-spacing: -0.5px; }
header p  { margin-top: .4rem; opacity: .8; font-size: 1rem; }

.container { max-width: 860px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  margin-bottom: 1.5rem;
}
.card h2 {
  font-size: 1.1rem;
  color: var(--green);
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  padding: 2.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: background .2s;
  position: relative;
}
.upload-zone:hover, .upload-zone.dragover { background: var(--light); }
.upload-zone input[type=file] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}
.upload-zone .icon { font-size: 2.5rem; }
.upload-zone p { color: var(--muted); margin-top: .5rem; font-size: .9rem; }
#preview-wrap { margin-top: 1rem; display: none; }
#preview-wrap img { max-width: 100%; border-radius: 8px; max-height: 280px; object-fit: cover; }

/* Option grid */
.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .6rem;
}
.option-grid label {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem .75rem;
  border: 1.5px solid #dce8de;
  border-radius: 8px;
  cursor: pointer;
  font-size: .88rem;
  transition: border-color .15s, background .15s;
}
.option-grid label:hover { border-color: var(--accent); background: var(--light); }
.option-grid input[type=checkbox]:checked + span,
.option-grid input[type=radio]:checked + span { font-weight: 600; }
.option-grid label:has(input:checked) {
  border-color: var(--green);
  background: var(--light);
}

/* Theme tiles */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: .8rem;
}
.theme-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  padding: .9rem .5rem;
  border: 2px solid #dce8de;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .82rem;
  text-align: center;
  transition: border-color .15s, background .15s;
}
.theme-tile .emoji { font-size: 1.8rem; }
.theme-tile:has(input:checked) { border-color: var(--green); background: var(--light); font-weight: 600; }
.theme-tile input { display: none; }

/* Form fields */
label.field-label { display: block; font-size: .88rem; font-weight: 600; margin-bottom: .4rem; color: var(--muted); }
input[type=email], textarea, select {
  width: 100%;
  padding: .65rem .85rem;
  border: 1.5px solid #dce8de;
  border-radius: 8px;
  font-size: .95rem;
  font-family: inherit;
  transition: border-color .15s;
  background: #fff;
}
input[type=email]:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 90px; }

/* Submit */
.btn-submit {
  display: block;
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, var(--green), #1b4332);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: .3px;
  transition: opacity .2s;
}
.btn-submit:hover { opacity: .9; }
.btn-submit:disabled { opacity: .6; cursor: not-allowed; }

/* Spinner overlay */
#spinner {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  gap: 1rem;
  font-size: 1.1rem;
}
#spinner.active { display: flex; }
.spinner-ring {
  width: 56px; height: 56px;
  border: 5px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Result */
#result-section { display: none; }
#result-section img { width: 100%; border-radius: var(--radius); }
.result-note { margin-top: .8rem; font-size: .88rem; color: var(--muted); text-align: center; }

.alert { padding: .85rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: .92rem; }
.alert-error { background: #fde8e8; color: #a00; border: 1px solid #f5c6c6; }
.alert-success { background: var(--light); color: var(--green); border: 1px solid var(--accent); }

footer { text-align: center; padding: 2rem; color: var(--muted); font-size: .82rem; }
