
/* --- 1. Generator UI Styles --- */
:root {
  --brand-color: #e63946; --light-gray: #f1faee; --mid-gray: #a8dadc; --dark-blue: #1d3557;
}
body {
  margin: 0; padding: 0; background: var(--light-gray); background-image: url("/images/pokemon-pattern.png"); background-repeat: repeat;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Helvetica Neue", "Noto Sans", sans-serif;
}
.controls {
  background: #fff; padding: 25px; margin-bottom: 20px; box-shadow: 0 4px 12px rgba(0,0,0,.1);
}
.intro-section {
  display: flex; justify-content: center; align-items: center; gap: 30px; margin: 0 auto 25px auto; max-width: 900px;
}
.intro-text h1 { margin: 0 0 10px 0; color: var(--dark-blue); text-align: left; }
.intro-text p { line-height: 1.6; color: #457b9d; max-width: 500px; text-align: left; }

.generator-ui { text-align: center; }
.mode-switcher { margin-bottom: 20px; display: flex; justify-content: center; align-items: flex-end; gap: 20px;}
.form-controls {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 20px;
}
.form-group {
  display: flex; flex-direction: column; align-items: flex-start; margin: 0;
}
.form-group label { font-weight: 600; font-size: 0.9em; margin-bottom: 5px; color: var(--dark-blue); }
.form-group input[type="number"], .form-group select, .form-group textarea, .form-group input[type="color"] {
  padding: 8px; border: 1px solid var(--mid-gray); border-radius: 6px; font-size: 1em; width: 150px;
  box-sizing: border-box;
}
.form-group textarea { width: 320px; height: 80px; resize: vertical; }
.form-group input[type="color"] { padding: 4px; height: 40px; }

.options-wrapper { display: flex; flex-direction: column; align-items: center; gap: 20px; margin-top: 20px; }
.style-options { border: 1px solid var(--mid-gray); border-radius: 8px; padding: 15px; text-align: left; width: fit-content; }
.style-options legend { font-weight: bold; color: var(--dark-blue); padding: 0 10px; cursor: pointer; user-select: none; }
.style-options legend::before { content: '▼'; display: inline-block; width: 1em; transition: transform 0.2s; }
.style-options.is-collapsed legend::before { transform: rotate(-90deg); }
.style-options.is-collapsed .style-grid { display: none; }
.style-grid { display: flex; flex-direction: column; gap: 20px; align-items: stretch; margin-top: 10px; }
.style-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; align-items: flex-start; }
.style-column { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 220px; }
.style-column h3 { font-size: 1em; margin: 0 0 2px 0; color: #457b9d; }
.style-group { display: flex; flex-wrap: wrap; gap: 5px; align-items: flex-end; }
.style-group .form-group { margin: 0; }
.style-group .form-group input { width: 60px; }
.style-group .form-group select { width: 90px; }
.toggle-group { flex-direction: row; align-items: center; gap: 8px; margin: 0; min-height: 25px; }
.toggle-group label { margin-bottom: 0; }
.slider-group { flex-direction: row; align-items: center; gap: 8px; width: 100%; }
.slider-group input[type="range"] { flex-grow: 1; }
.slider-group .value-display { font-size: 0.9em; min-width: 40px; text-align: right; color: #457b9d; }

.generate-btn {
  background: var(--brand-color); color: white; border: none; padding: 10px 25px; font-size: 1.1em;
  font-weight: bold; border-radius: 6px; cursor: pointer; transition: background-color 0.2s;
  vertical-align: bottom; min-width: 150px;
}
#error-message { color: var(--brand-color); font-weight: bold; margin-top: 15px; min-height: 20px; text-align: center; }

.bmac-badge { position: fixed; top: 15px; right: 15px; z-index: 9999; }
.hidden { display: none !important; }

/* --- 2. Print & Card Styles --- */
.sheet { box-sizing: border-box; background: #fff; display: grid; justify-content: center; align-content: center; page-break-after: always; break-inside: avoid; }
.card { box-sizing: border-box; background-color: #fff; border: 0.6mm solid #000; display: flex; flex-direction: column; overflow: hidden; position: relative; }
.card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 0; background-image: var(--bg-image); background-repeat: var(--bg-repeat); background-size: var(--bg-size); background-position: var(--bg-position); opacity: var(--bg-opacity); transition: opacity 0.1s; }
.card.bg-silhouette::before { filter: brightness(0); }
.card__image { flex-shrink: 0; display: flex; align-items: center; justify-content: center; transition: height 0.1s; position: relative; z-index: 1; }
.card__image img { width: 100%; height: 100%; display: block; object-fit: contain; }
.card__meta { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 3mm; text-align: center; line-height: 1.15; position: relative; z-index: 1; }
.card__name, .card__num { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card__num { font-variant-numeric: tabular-nums; }
.card__types { display: flex; gap: 5px; }
.type-badge { padding: 2px 8px; border-radius: 4px; color: white; font-size: 8pt; text-transform: uppercase; font-weight: bold; border: 1px solid rgba(0,0,0,0.2); }
.card__image img.img--silhouette { filter: brightness(0); }
.card--no-image .card__image { display: none; }
.card--no-image .card__meta { justify-content: center; }
.showcase-container { transform-origin: center center; box-shadow: 0 4px 24px rgba(0,0,0,0.15); transition: transform 0.2s; }

/* --- 3. Media Queries --- */
@media screen { .sheet { box-shadow: 0 2px 24px rgba(0,0,0,.12); margin: 10mm auto; } #output { padding: 10mm 0; } }
@media (max-width: 768px) { .intro-section { flex-direction: column-reverse; } .bmac-badge { display: none; } }

@media print {
    body { background: #fff; } .controls, .bmac-badge { display: none; }
    .card, .type-badge, .card::before { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
