body {
  font-family: Arial, sans-serif;
  background: #111;
  color: #fff;
  display: flex;
  justify-content: center;
  padding: 20px;
}

#app {
  display: flex;
  gap: 40px;
  max-width: 1200px;
}

/* We *display* at 600x600, art is still 3600x3600 */
#preview {
  flex: 0 0 600px;      /* <-- NEW: don't shrink, lock to 600px */
  width: 600px;
  height: 600px;
  background: #ffffff;
  border: 2px solid #333;
  position: relative;
  overflow: hidden;
}

/* Images fill the preview box, scaled down */
#preview img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;   /* scale to 600x600 while preserving alignment */
  height: 100%;
}

#controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 320px;
  flex: 1 1 auto;       /* <-- NEW: let the controls flex instead */
}

h2 {
  margin-bottom: 4px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label {
  font-weight: bold;
}

select,
input,
textarea {
  padding: 6px;
  border-radius: 4px;
  border: 1px solid #555;
  background: #222;
  color: #fff;
}

textarea {
  resize: vertical;
}

button#summary-btn {
  margin-top: 8px;
  padding: 8px 10px;
  background: #3b82f6;
  border: none;
  border-radius: 4px;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
}

button#summary-btn:hover {
  background: #2563eb;
}

#summary {
  margin-top: 10px;
  padding: 10px;
  border-radius: 4px;
  background: #1e293b;
  border: 1px solid #334155;
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: pre-line; /* respect newlines in text */
}

hr {
  border: none;
  border-top: 1px solid #333;
  margin: 8px 0;
}

#card-controls {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#card-controls button {
  padding: 6px 10px;
  background: #0f766e;
  border: none;
  border-radius: 4px;
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
}

#card-controls button:hover {
  background: #115e59;
}

#card-image {
  margin-top: 10px;
  max-width: 400px;
  border: 1px solid #333;
  display: none; /* hidden until we generate a card */
}

/* Card buttons (already present in some versions, repeat is harmless) */
#card-controls {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#card-controls button {
  padding: 6px 10px;
  background: #0f766e;
  border: none;
  border-radius: 4px;
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
}

#card-controls button:hover {
  background: #115e59;
}

#card-image {
  margin-top: 10px;
  max-width: 400px;
  border: 1px solid #333;
  display: none; /* shown after card generation */
}

/* Disclaimer text */
#disclaimer {
  margin-top: 14px;
  font-size: 0.8rem;
  line-height: 1.4;
  color: #9ca3af;
}

#disclaimer .signature {
  display: inline-block;
  margin-top: 4px;
  font-style: italic;
  color: #e5e7eb;
}

/* Mobile / narrow screens: stack everything */
@media (max-width: 900px) {
  body {
    padding: 12px;
  }

  #app {
    flex-direction: column;
    gap: 16px;
    max-width: 100%;
  }

  #preview {
    flex: none;
    width: 100%;
    max-width: 600px;      /* keeps your art from becoming huge */
    aspect-ratio: 1 / 1;   /* keeps it square */
    height: auto;
    margin: 0 auto;        /* centers preview */
  }

  #controls {
    min-width: 0;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
  }

  #card-image {
    max-width: 100%;
  }
}

